//View Tip #92
Similar Tips
» Version all unversioned files in an SVN checkout
» Get latest stable version of the Linux kernel
» Multiple column sort
» Graph connections to hosts
» MAC address conversion


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