Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Linux comand: grep
(view source)
Revision as of 06:36, 18 August 2016
4 bytes added
,
06:36, 18 August 2016
no edit summary
Line 42:
Line 42:
grep -rnw '/path/' -e "pattern"
grep -rnw '/path/' -e "pattern"
−
* r or -R is recursive,
+
*
-
r or -R is recursive,
−
* n is line number, and
+
*
-
n is line number, and
−
* w stands match the whole word.
+
*
-
w stands match the whole word.
−
* l (lower-case L) can be added to just give the file name of matching files.
+
*
-
l (lower-case L) can be added to just give the file name of matching files.
--exclude or --include parameter could be used for efficient searching. Something like below:
--exclude or --include parameter could be used for efficient searching. Something like below:
grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version