Feed on
Posts
Comments

i’ve got a bunch of files with one line — a number — and i’d like to sort those filenames on the command line based on that number.

to that in one line of shell code:

for i in `ls *.*`; do echo “`head -n1 $i` $i” ; done | sort -n


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.