Skip to content

Instantly share code, notes, and snippets.

@amosshapira
Created March 21, 2017 05:28
Show Gist options
  • Save amosshapira/0ce4494c158dd717b85a5d6fb5d26a25 to your computer and use it in GitHub Desktop.
Save amosshapira/0ce4494c158dd717b85a5d6fb5d26a25 to your computer and use it in GitHub Desktop.
Sort on date field using GNU sort
# sample input:
# some-single-word 06/04/2011 03/04/2017
# this will sort on the date field on the third column
# The main trick is the appending of "-n" at the end, for some reason this does it
gsort -b -k 3.7,3.10 -k 3.4,3.5 -k 3.1,3.2 -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment