How do you search for a string in a file in Unix?

Pham Quỳnh

New member
How do you search for a string in a file in Unix?
Answer
The grep command
searches through the file, looking for matches to the pattern specified. To use it type grep , then the pattern we’re searching for and finally the name of the file (or files) we’re searching in. The output is the three lines in the file that contain the letters ‘not’.
 

Tìm kiếm

Back
Top