Created
September 12, 2014 09:42
-
-
Save korovamilk/d18ca6555d7f7006e51d to your computer and use it in GitHub Desktop.
Find Pattern in file and print matching strings when occurencies > 1 (per line)
This file contains hidden or 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
# example email - real name list "<filename>" | |
# (note that name4 entry is broken - email appears 2 times | |
[email protected];"Real Name" | |
[email protected];"Real Name" | |
[email protected];"Real Name" | |
[email protected];[email protected];"Real Name" | |
# following awk will find and print the lines with MORE than one matching pattern | |
# (here I grep for "@") | |
$ awk '{n=split($0,c,"@")-1;if (n>1) print $0 }' <filename> | |
[email protected];[email protected];"Real Name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment