grep

grep - searches input files for lines containing a match to a given pattern list.


Search all lines in file mp3_list.txt which contains word mozart:

grep mozart mp3_list.txt

Search all lines in file mp3_list.txt which contains word mozart (ignoring case):

grep -i mozart mp3_list.txt

Search all lines in file mp3_list.txt which doesn't contain word beethoven:

grep -v beethoven mp3_list.txt

Count how many lines contains "mozart" has occurred in the file mp3_list.txt:

grep -c mozart mp3_list.txt

Show which lines "mozart" has appeared:

grep -n mozart mp3_list.txt