Created
December 26, 2017 15:04
-
-
Save Vladnev/8bcbbba6f9575ea52117488519f2609b to your computer and use it in GitHub Desktop.
Grep usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep <pattern> <file> | |
grep -Hsi <pattern> <dir> | |
flags: | |
-r - recursive(include subdirs) | |
-l - show only filenames where was found pattern | |
-H - show in which file was found row | |
-с - count of pattern matches | |
-v - show only non-matches | |
-i - ignore case | |
-n - add row number to output | |
-s - hide errors | |
-w - only full word match | |
-C <num> - rows arround | |
-A <num> - row down | |
-B <num> - row up | |
-E - regex matching | |
patterns: | |
'\<word_start' | |
'word_end\>' | |
'^line_start' | |
'line_end$' | |
"word[<start>-<end>]" | |
"word[^<uninclude>]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment