//View Tip #742
Similar Tips
» Concatenate pairs of lines
» Get real names of current users
» Graph connections to hosts
» iso2cd
» Crawl a web page for links

 

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