Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

10.0;fpat (find_pattern), revision 1.0, 88/03/21
fpat (find_pattern) -- Find a text pattern in an ASCII file.
usage: fpat [-a | -x] [-c] [-i] [-l] [-m n] [-lf]
                        [-lm]
                        [-rm n]
                        [-rmf n]
                        [pathname... -p] reg_expr...
                        [-out pathname]



DESCRIPTION
     fpat searches its input file(s) for lines matching the specified regular
     expressions and writes them to standard output or the file specified.


ARGUMENTS
     reg_expr... (required)
                      One or more regular expression patterns.  By default, a
                      line that contains any of these expressions matches and
                      is written to standard output.  For a description of
                      regular expressions used for pattern matching, type help
                      patterns.  Patterns containing embedded spaces or shell
                      special characters must be enclosed in quotation marks.

     pathname -p (optional)
                      Specify name of file to be searched.  If you specify a
                      pathname with this argument, you must follow it with -p
                      to separate the pathname(s) from the search patterns on
                      the command line.  Multiple pathnames and wildcarding
                      are permitted.

                      Default if omitted: read standard input

OPTIONS
     If no options are specified, any line that matches any of the regular
     expressions is considered a matching line.

     -out pathname    Write output to specified file.  If input filenames are
                      specified, the output filename can be derived.  If this
                      option is not specified, matching lines are written to
                      standard output.

     -a               Select only lines that match all regular expressions, in
                      any order.

     -x               Select only lines containing none of the regular
                      expressions.

     -c               Write only a count of matching lines, not the lines
                      themselves.

     -i               Ignore cases for search (that is, become case-
                      insensitive).

     -l               Write line number with each line that matches the
                      regular expression.

     -m n             Set the maximum number of search lines to n (a decimal
                      value).  fpat terminates after searching n lines.

     -lf              Display the name of the file being examined before
                      searching its lines.

     -lm              Similar to -lf, but display the name(s) of only those
                      file(s) that contain matches for the regular expression.

     -rm n            Set the maximum number of matches to be reported for
                      this execution of fpat.

     -rmf n           Set the maximum number of matches to be reported for
                      each file being searched.

EXAMPLES
     Assume the file text contains the following:

     now
     is
     the
     time
     for
     all
     good


     Then the command

     $ fpat text -p o

     produces ...

     now
     for
     good
     $


     ... and the command

     $ fpat -x -m 5 -l text -p o


     produces ...

      (     2) is
      (     3) the
      (     4) time
      (     6) all
      $


     Search for the string "the" in all files whose names begin with "text".

     $ fpat text?* -p the


     Search for the string /fBthe in all files whose names begin with text,
     (that is, text, text1, text_file, etc.) and write the output to the files
     text.out, text1.out, text_file.out, etc.

     $ fpat text?* -p the -out =.out



SEE ALSO
     More information is available.  Type

     help  fpatb    For details about searching for blocks of lines containing
                    text patterns

     help  patterns For a description of regular expressions

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