sort a file by line length

2022-01-28

this
is
a
test

cat test | awk '{ print length, $0 }' | sort -n | cut -d" " -f2-

a
is
test
this