Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fgrep(1) — sysv — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ed(1)

egrep(1)

grep(1)

sed(1)

sh(1)



FGREP(1-SysV)       RISC/os Reference Manual        FGREP(1-SysV)



NAME
     fgrep - search a file for a character string

SYNOPSIS
     fgrep [options] string [file ...]

DESCRIPTION
     fgrep (fast grep) seaches files for a character string and
     prints all lines that contain that string.  fgrep is dif-
     ferent from grep(1) and egrep(1) because it searches for a
     string, instead of searching for a pattern that matches an
     expression.  It uses a fast and compact algorithm.

     The characters $, *, [, ^, |, (, ), and \ are interpreted
     literally by fgrep, that is, fgrep does not recognize full
     regular expressions as does egrep.  Since these characters
     have special meaning to the shell, it is safest to enclose
     the entire string in single quotes '...'.

     If no files are specified, fgrep assumes standard input.
     Normally, each line found is copied to the standard output.
     The file name is printed before each line found if there is
     more than one input file.

     Command line options are:

     -b    Precede each line by the block number on which it was
           found.  This can be useful in locating block numbers
           by context (first block is 0).

     -c    Print only a count of the lines that contain the pat-
           tern.

     -i    Ignore upper/lower case distinction during comparis-
           ons.

     -l    Print the names of files with matching lines once,
           separated by new-lines.  Does not repeat the names of
           files when the pattern is found more than once.

     -n    Precede each line by its line number in the file
           (first line is 1).

     -v    Print all lines except those that contain the pattern.

     -x    Print only lines matched entirely.

     -e string
           Search for the given string.  Useful if string begins
           with a -).

     -f file



                         Printed 1/15/91                   Page 1





FGREP(1-SysV)       RISC/os Reference Manual        FGREP(1-SysV)



           Take the list of strings from file.

SEE ALSO
     ed(1), egrep(1), grep(1), sed(1), sh(1).

DIAGNOSTICS
     Exit status is 0 if any matches are found, 1 if none, 2 for
     syntax errors or inaccessible files (even if matches were
     found).

ERRORS
     Ideally there should be only one grep command, but there is
     not a single algorithm that spans a wide enough range of
     space-time tradeoffs.  Lines are limited to BUFSIZ charac-
     ters; longer lines are truncated. BUFSIZ is defined in
     /usr/include/stdio.h.







































 Page 2                  Printed 1/15/91



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026