DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 9th November 2015
jb_daefo jb_daefo is offline
Spam Deminer
 
Join Date: May 2008
Posts: 265
Default Sorting on the file, given a list of files-with-path (beta)

Have a file you want to sort on the last field?

IOW a file or a pipe:
say, files.txt

/a/b/c/file2.htm
a/b/file3.htm
/a/first-file.htm

Untested, but found a use-this-time working solution

cat files.txt | gtr -s \/ " " | perl -lne 'print join " ", reverse split / /' | sort

That or later varation with a slight modification enabled here a tee-to-a-file
that I can read later as a solution to this week's problem (a few files accidentally
deleted from a backup after a disk crash... so I can ascertain whether they
can/should be replaced/lost etc. ... most were found elsewhere in the
filesystem, a few not... )

Note that this solution was from a thread, and is only mostly understood here.
__________________
FreeBSD 11.0-CURRENT
Reply With Quote
Reply

Tags
gtr perl sort

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
fresh install require file flags schg assigned to dir or files? dbach OpenBSD Security 4 1st May 2012 05:50 PM
list open files - fstat? jsmith6134 OpenBSD General 3 2nd September 2011 03:11 AM
Mailing list application Majordomo 2 reveals file content J65nko News 1 3rd February 2011 07:52 PM
ls sorting of numbered files gosha General software and network 6 11th April 2009 01:07 PM
Sorting Packages JMJ_coder NetBSD Package System (pkgsrc) 3 20th May 2008 01:08 AM


All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick