egrep-searches a file for a pattern using full regular expressions

 <  Day Day Up  >  

egrep ”searches a file for a pattern using full regular expressions

 egrep [ bchilnsv ] [ e specialexpression ][ f filename ] [ strings ] [ filename ... ] 

egrep (expression grep) searches files for a pattern of characters and prints all lines that contain that pattern. egrep uses full regular expressions (expressions with string values that use the full set of alphanumeric and special characters) to match the patterns.

Example A.23.
 1   egrep 'TomJohn' datafile 2   egrep '^ [A-Z]+' file 

EXPLANATION

  1. Displays all lines in datafile containing the pattern either Tom or John .

  2. Displays all lines starting with one or more uppercase letters .

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net