Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fpatb — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

FPAT

patterns

PATTERNS

6.0; fpatb (find_pattern_block), revision 6.0, 83/04/15
FPATB (FIND_PATTERN_BLOCK) -- Search for blocks of lines containing text patterns.
usage:  FPATB [-A | -X | -C] [-L n] [-LF] [-B reg_expr1 [-E reg_expr2] ]
              [-OUT pathname] [pathname... -P] reg_expr ...


FORMAT

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


  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".

  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 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 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 conjuction
                   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.


EXAMPLE

  $ fpatb address_list -p 01824 -out zip_list     Locate text blocks containing
  $                                               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