//View Tip #92
Similar Tips
» List only the files that have been updated today.
» Graph connections to hosts
» My code is compiling
» Count files by type v2
» Kill matching processes


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Sort a file by line length:

cat test.txt | awk '{ printf "%06d|%s\n",length($0),$0}' | sort | cut -b'8-'

View Comments »


Add your comment

Comments are currently disabled
Since its all about awk. How about this:

cat test.txt | awk '{ printf "%06d|%s\n",length($0),$0}' | sort | awk -F"|" '{print $2}'
Posted 2010-03-11 02:34:21

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit