fgrep-searches a file for a character string

 <  Day Day Up  >  

fgrep ”searches a file for a character string

 fgrep [ bchilnsvx ] [ e special string ] [ f filename ] [ strings ] [ filename ... ] 

fgrep (fast grep) searches files for a character string and prints all lines that contain that string. fgrep is different from grep and egrep because it interprets regular expression metacharacters as literals.

Example A.25.
 1   fgrep '***' * 2   fgrep '[ ] * ? $' filex 

EXPLANATION

  1. Displays any line containing three asterisks from each file in the present directory. All characters are treated as themselves (i.e., metacharacters are not special).

  2. Displays any lines in filex containing the string enclosed in quotes.

 <  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