Sort Lines by Length

I have a file containing quite many lines of strings and I want to sort them by line length. Here is how.

1
cat $file | awk '{ print length($0) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | less