Created
August 15, 2020 07:50
-
-
Save henkin/aee1642825367ae8e745fdd05e931911 to your computer and use it in GitHub Desktop.
match words in a list print
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
awk 'NR==FNR {a[$1]++; next} $1 in a' words myfile | |
grep -Fw -f words myfile | |
#* This would extract the lines in myfile that contains the words in the file words anywhere. | |
#The strings in words are treated as fixed strings (not regular expressions) due to the -F option, and the -w option ensures that we only get lines that contains the exact same word (no matches of substrings in words are allowed). | |
#The words in the file words most be listed on separate lines. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment