Posted in Code, Command Line, Linux Sort by Line Length Binny V A April 14, 2009 1 Comment on Sort by Line Length Sort file by line length. Original Article… cat /etc/passwd | awk '{print length, 0}' | sort -n | awk '{1=""; print $0 }' Author: Binny V AA philosopher programmer who specializes in backend development and stoicism.
cat /etc/passwd | perl -e ‘print sort { length(a) length(b) } ‘