Skip to content

Instantly share code, notes, and snippets.

@aslafy-z
Last active March 20, 2025 17:23
Show Gist options
  • Save aslafy-z/600da98efe6d09434faa8843c82c1f0b to your computer and use it in GitHub Desktop.
Save aslafy-z/600da98efe6d09434faa8843c82c1f0b to your computer and use it in GitHub Desktop.
`sort -V` with sort versions that have no `-V`. Source https://stackoverflow.com/a/23993452/4266494.
sed -Ee 's/^([0-9.]+)$/\1.-1/' | sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 | rev | cut -d. -f2- | rev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment