Skip to content

Instantly share code, notes, and snippets.

@Habetdin
Created March 4, 2019 10:35
Show Gist options
  • Save Habetdin/6b510953291790eb4b4f2a6b4a63d5a6 to your computer and use it in GitHub Desktop.
Save Habetdin/6b510953291790eb4b4f2a6b4a63d5a6 to your computer and use it in GitHub Desktop.
Remove duplicates, but keeping only the last occurrence
# from the comments of https://backreference.org/2011/11/17/remove-duplicates-but-keeping-only-the-last-occurrence/
tac <src-file> | awk '!a[$0]++' | tac | tee <dst-file>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment