Skip to content

Instantly share code, notes, and snippets.

@AWinterman
Created August 6, 2013 22:02
Show Gist options
  • Save AWinterman/6169146 to your computer and use it in GitHub Desktop.
Save AWinterman/6169146 to your computer and use it in GitHub Desktop.
varsort.sh
#!/usr/bin/env sh
# varsort: reorder lines according to length.
cat $0 | awk '{print length($0), $0}' | sort -n | tac | cut -d' ' -f2-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment