Hamilton LaboratoriesHamilton C shell 2012User guideExternal utilities


Oregon Coast

Previous | Next

        Fast String Search (Fast grep) of Text Files

Usage:  fgrep [-hbcilnqsvwx-] [-f ptrnfile] [ pattern ] [ file1 file2 ...]

   fgrep does a quick, deliberately simple string search.  It
   does not use regular expressions, but does have some diff-style
   options for ignoring upper-/lower-case differences or treating
   white spaces of any length as equal, etc.  You can also give it
   a list of strings you want searched for, one per line in a
   pattern file or via stdin.

   Each matching line is copied to stdout.  If more than one file
   is being searched, each line is preceded by the name of file
   where the matched occurred plus a ':' character.


   -h           Help.  (This screen.)
   -b           Blank spaces of any length compare equal.  Ignore
                any leading or trailing white space on each line.
   -c           Just print a count of the number of lines which
   -f ptrnfile  Read the patterns from a file.
   -i           Ignore character case.
   -l           Show just the names of any files containing at
                least one match.  Show each name only once, each
                on a separate line.
   -n           Show the line numbers of any matches.
   -q           Quiet:  don't show filenames where the matches
   -s           Read the patterns from stdin.
   -v           Invert the pattern:  show all lines EXCEPT those
                that match.
   -w           White space is ignored totally.
   -x           Exact match:  the whole line must match the pattern.
   --           End of options.

Previous | Next