Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fpatb — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

FPAT

PATTERNS

8.0;fpatb (find_pattern_block), revision 8.0, 87/03/20
FPATB (FIND_PATTERN_BLOCK) -- Find blocks of text containing patterns.
usage:  FPATB [-A|-X|-C] [-L n] [-LF] [-B reg_expr1 [-E reg_expr2]]
                                        [pathname... -P] reg_expr...
                                        [-OUT pathname]


FORMAT

  FPATB [options] [pathname... -P] reg_expr ... [-OUT pathname]


  FPATB  reads blocks of text from its input files and writes them to its output
  file(s) so they meet the specified matching criteria.  By default,  blocks  of
  lines  are  separated  by  an  empty line or by a line containing only blanks.
  FPATB is similar to FPAT (FIND_PATTERN) except that if a pattern is found, the
  entire  block of lines is copied to output, rather than only the line in which
  the pattern  occurs.    Thus,  it  is  useful  for  searching  mailing  lists,
  bibliographies, and similar files, where several lines are grouped together to
  form cohesive units.


ARGUMENTS

  reg_expr
  (required)         Specify regular expression to be used for matching  search.
                     Each expression defines a text pattern, and you can specify
                     up to nine expressions with each FPATB command.   FPATB  is
                     case-sensitive;  for  example,  "a"  is different from "A".
                     For a description of regular expressions used  for  pattern
                     matching, type HELP PATTERNS.

  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.  Blocks must be less than 15,000 characters.

                     Default if omitted:  read standard input


OPTIONS

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

  -OUT pathname
                     Write  output  to specified file.  If input file names were
                     specified, output filename can be derived.  If this  option
                     is  specified,  it  must  be the last option on the command
                     line  (i.e.,  it  must  follow  any   regular   expressions
                     specified).    If  this  option  is not specified, matching
                     lines are written to standard output.

  -A                 Select only blocks containing lines that match ALL  regular
                     expressions, in any order.

  -X                   Select   only  blocks  containing  NONE  of  the  regular
                     expressions.

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

  -B reg_expr1        Specify  'reg_expr1'  as the block separator, instead of a
                     blank or empty line.  Text blocks begin at lines containing
                     'reg_expr1'.  If -B is specified and -E is not, 'reg_expr1'
                     begins and ends the block.

  -E reg_expr2       Specify 'reg_expr1' to start a block and 'reg_expr2' to end
                     a  block.    Note  that  the  -E  option  is  used  only in
                     conjunction with the -B option.

  -L n               Write only the first n lines of  selected  blocks.    If  a
                     block  contains  fewer  than  n lines, this option pads the
                     output block with blank lines.

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



EXAMPLES

  $ fpatb address_list -p 01824 -out zip_list   Locate text blocks with
  $                                             the string "01824" in
                                                the file "address_list"
                                                and write the results
                                                to "zip_list".


RELATED TOPICS

  More information is available.  Type:

  - HELP FPAT
   for details about searching files for single lines containing text patterns.

  - HELP PATTERNS
   for a description of regular expressions.

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