Previous Section  < Day Day Up >  Next Section

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.

    Previous Section  < Day Day Up >  Next Section