Skip to content

Instantly share code, notes, and snippets.

@Liam-Nothing
Created September 10, 2023 22:21
Show Gist options
  • Save Liam-Nothing/281b59295c278ac5857f554e6cac1f90 to your computer and use it in GitHub Desktop.
Save Liam-Nothing/281b59295c278ac5857f554e6cac1f90 to your computer and use it in GitHub Desktop.
One-liner command in the shell to sort each line of a file by length.
python -c "lines = open('_top_level_domains.txt').readlines(); lines.sort(key=len); open('output.txt', 'w').writelines(lines)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment