linux - How can I print a particular list of text using gawk/grep ? for example I would like to print the names of all the colors present in txt file -
just started learning linux. getting hands dirty grep , gawk.
suppose want print available names in .txt file or example have text file goes;
"blah blah blah blah blah blah bhah blah blah blah joe allen david john blah blah blah blah blah "
now print names found in text file only. how go doing it? syntax be?
having file "names" names you're looking for, 1 per line:
allen david joe ...
then search of of lines:
grep -f names thefiles
you might need add option -f (the lines in file "names" strings, , not regex-en) or option -w (the match must word, not part of word) well, or option -o (print match, instead of line).
Comments
Post a Comment