How do you grep for a specific word in Unix?

How do you grep for a specific word in Unix?
Answer
Search any line that contains the word in filename on Linux: grep ‘word’ filename. Perform a case-insensitive search for the word ‘bar’ in Linux and Unix: grep -i ‘bar’ file1. Look for all files in the current directory and in all of its subdirectories in Linux for the word ‘httpd’ grep -R ‘httpd’ .
 

Tìm kiếm

Back
Top