Grep: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
grep searches the name file or files for the specified string. (You can also use egrep to search inside a file using [[Regular Expressions]] ) | grep searches the name file or files for the specified string. (You can also use egrep to search inside a file using [[Regular Expressions]] ) | ||
<code>grep bananas filename.txt</code> This searches for the word '''bananas''' in the file, '''filename.txt''' | <code>grep bananas filename.txt</code> This searches for the word '''bananas''' in the file, '''filename.txt''' |
Revision as of 01:22, 22 December 2016
Usage
grep searches the name file or files for the specified string. (You can also use egrep to search inside a file using Regular Expressions )
grep bananas filename.txt
This searches for the word bananas in the file, filename.txt
Note that the search is case sensitive. It will not find Bananas, or BANANAS.
If you want it to find all of those, use:
grep -i bananas filename.txt
Also, it just searches for that string. It will match partial words, whole words, and that string inside a whole block of text.