Grep: grep is one of many standard UNIX utilities. It searches files for specified words or patterns. First clear the screen, then type
% grep college college.txt
As you can see, grep has printed out each line containg the word college.
% grep College college.txt
The grep command is case sensitive; it distinguishes between College and college. To ignore upper/lower case distinctions, use the -i option,
% grep -i College college.txt
To search for a phrase or pattern, you must enclose it in single quotes (the apostrophe symbol). For example to search for spinning top,
% grep -i ‘spinning top’ college.txt
Some of the other options of grep are:
-v display those lines that do NOT match
-n precede each matching line with the line number
-c print only the total count of matched lines You can use more than one option at a time. For example, the number of lines without the words college or College is
% grep -ivc college college.txt