Skip to content

Instantly share code, notes, and snippets.

@dandosi
Last active December 6, 2021 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandosi/fa690a92d9a99435c39db7e59203290a to your computer and use it in GitHub Desktop.
Save dandosi/fa690a92d9a99435c39db7e59203290a to your computer and use it in GitHub Desktop.
sort using a field in the middle of the line, sort your history
# if you're looking for the last test you executed in December, BUT your history shows "the command number" first
# so, you have to sort by... The *Third field* 😊
# This avoids a problem if you've closed multiple shells, so the order of the commands in history is not chronological
history | grep gradlew | grep test | grep "12/" | sort -k 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment