Created
March 4, 2019 10:35
-
-
Save Habetdin/6b510953291790eb4b4f2a6b4a63d5a6 to your computer and use it in GitHub Desktop.
Remove duplicates, but keeping only the last occurrence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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