Grep: Difference between revisions
Jump to navigation
Jump to search
Created page with "== 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 ) <code>grep bananas..." |
No edit summary |
||
Line 3: | Line 3: | ||
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 | <code>grep bananas filename.txt</code> 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: | |||
<code>grep -i bananas filename.txt</code> | |||
Also, it just searches for that string. It will match partial words, whole words, and that string inside a whole block of text. | |||
Line 10: | Line 19: | ||
<ol> | <ol> | ||
<li>[http://man.he.net/?topic=grep§ion=all grep man page]</li> | <li>[http://man.he.net/?topic=grep§ion=all grep man page]</li> | ||
<li>[http://www.thegeekstuff.com/2009/03/15-practical-unix-grep-command-examples Geek Stuff grep Examples]</li> | |||
</ol> | </ol> |
Revision as of 01:21, 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.