//View Tip #742
Similar Tips
» Randomize lines in a file
» Check low space
» Get an ordered list of subdirectory sizes
» Crawl a web page for links
» Actively Monitor a File

 

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
The command below can be used to sort the lines of a file by ascending order (shortest first). Change 'sort -n' to 'sort -nr' to sort in descending order (longest first).

cat /etc/passwd | awk '{print length, $0}' | sort -n | awk '{$1=""; print $0 }'


View Comments »




Comments 

Add your comment

Comments are currently disabled
No Comments

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit