Created
May 8, 2013 05:19
-
-
Save ejoubaud/5538381 to your computer and use it in GitHub Desktop.
Awk for Turtlestein: Find duplicates elements in a list
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
# Find duplicates in a textual list | |
# | |
# Just: | |
# * paste the list into Sublime | |
# * paste this line in Shell Turtlestein (plugin) invite | |
# * replace $1 by $<element_column_index> if there are more than 1 column | |
# * add flag -F if columns separator is not default (spaces and tabs) | |
# | |
# Can be easily adapted for VIM, it's just awk | |
| awk '{ items[$1] = items[$1] + 1 } END { for (item in items) { if (items[item] > 1) { print item ": " items[item] } } }' > | |
<<COMMENT | |
2001 | |
102 | |
12 | |
2001 | |
100 | |
becomes | |
2001: 2 | |
COMMENT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment