Difference between revisions of "Grep"

From wiki
Jump to navigation Jump to search
(Created page with "Find pattern in data stream (files, standard input) ;grep <pattern> <files> :Find pattern in any of the files. :When multiple files are scanned the filename is reported too...")
 
m
Line 8: Line 8:
 
;-i
 
;-i
 
:Ignore case  
 
:Ignore case  
;-n
+
;-l
:Only report filname of files with matches
+
:Only report filename of files with matches
 
;-h
 
;-h
 
:Suppress reporting of filenames when multiple files are scanned.  
 
:Suppress reporting of filenames when multiple files are scanned.  
;-l
+
;-n
 
:Report linenumber of matches too
 
:Report linenumber of matches too

Revision as of 12:28, 1 November 2018

Find pattern in data stream (files, standard input)

grep <pattern> <files>
Find pattern in any of the files.
When multiple files are scanned the filename is reported too (see -h below)
Useful options
-i
Ignore case
-l
Only report filename of files with matches
-h
Suppress reporting of filenames when multiple files are scanned.
-n
Report linenumber of matches too