How do I use grep to find a word in a file?

Minh Phượng

New member
How do I use grep to find a word in a file?
Answer
The easiest of the two commands is to use grep’s -w option. This will find only lines that contain your target word as a complete word. Run the command “grep -w hub” against your target file and you will only see lines that contain the word “hub” as a complete word.
 

Tìm kiếm

Back
Top