Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fpat — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

FPATB

patterns

PATTERNS

6.0; fpat (find_pattern), revision 6.0, 83/04/15
FPAT (FIND_PATTERN) -- Find a text pattern in an ASCII file.
Usage: FPAT [-A | -X] [-C] [-I] [-L] [-M lines] [-LF] [file... -P] pat...
            [-OUT output_file]


FORMAT

  FPAT [options] [pathname... -P] reg_expr ...


  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 one of the regular
  expressions is considered a matching line.

  -OUT pathname    Write output to specified file.  If input file names were
                   specified, 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 (i.e., 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.


EXAMPLES

  1. Assume the file "text" contains:

     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
   $

  2. $ fpat text?* -p the           Search for the string "the" in all files
                                     whose names begin with "text".

  3. $ fpat text?* -p the -out =.out      Search for the string "the" in all
                                           files whose names begin with "text",
                                           (i.e., "text", "text1", "text_file",
                                           etc.) and write the output to the
                                           files "text.out", "text1.out",
                                           "text_file.out", etc.


RELATED TOPICS

  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