Search for text in a file using Terminal on Mac
To locate a string within a file, use the
grep tool searches the named input files for lines containing a match to the given pattern. By default,
grep prints the matching lines.
To search for a unique string in a file:
% grep search_string filename
Replace search_string with the string to search for, and replace filename with the name of the file whose contents you want to search.