

FB (1)                       5/28/80                       FB (1)


NAME
       fb - search blocks of lines for text patterns

SYNOPSIS
       fffbbb [-acx] [-ln] [-sexpr [-sexpr]] expr [expr ...]

DESCRIPTION
       "Fb"  (find block) searches blocks or groups of lines in a
       file for text patterns.  It is similar  to  'find'  except
       that  if  a pattern is found, the entire block of lines is
       copied to standard output, rather than simply the line  in
       which  the  pattern  occurred.   Thus  it  is  useful  for
       searching  mailing  lists,  bibliographies,  and   similar
       files  where  several  lines  are grouped together to form
       cohesive units. 
       
       The search patterns  may  be  any  regular  expression  as
       described in the 'ed' and 'find' writeups. 
       
       "Fb"  assumes  the  blocks  of  lines  are separated by an
       empty line or a line containing only  blanks.   When  "fb"
       is  called without any options, standard input is read and
       each line is checked to see  if  it  matches  any  of  the
       regular  expressions  given  as arguments.  If any matches
       are  found,  the  entire  block  is  printed  on  standard
       output. 
       
       Other options include:
       
         -a      Only  print  the  block if ALL the arguments are
                 found within it
                 
         -x      Only print the block if none  of  the  arguments
                 are found within it
                 
         -c      Only  print  a  COUNT  of  the  number of blocks
                 found which match/don't match the expressions
                 
         -sexpr  Use 'expr' as the block separator (instead of  a
                 blank  or  empty line).  "Expr" can be a regular
                 expression just as the search arguments can. 
                 
                 If two "-sexpr" arguments are given,  the  first
                 one  is  considered  to  be  the  pattern  which
                 starts  a  block  (e.g.  -ssubroutine)  and  the
                 second  is  considered  the pattern which ends a
                 block (e.g. -send). 
                 
         -ln     prints only the first 'n' lines  of  the  block;
                 if  the  block contains less than 'n' lines, the
                 block is padded out with blank lines. 
       
       Care should be taken when using the characters % $ [  ]  !
       *  @  and  any shell characters in the text pattern. It is
       often  necessary  to  enclose  the   entire   substitution
       pattern in quotes. 


                               -1-




FB (1)                       5/28/80                       FB (1)


FILES
       A  scratch  file  ("fbt")  is  used  if  the internal line
       buffer becomes full. 

SEE ALSO
       find, ed
       For a complete description  of  regular  expressions,  see
       "Software Tools" pages 135-154. 

DIAGNOSTICS
       Error messages are given if:
          a)  One of the patterns given is illegal
          b)  Too many separators are given (2 are allowed)
          c)   The  maximum  number of expressions is exceeded (9
          are allowed)
          d)  There are problems opening the scratch  file  (when
          the block line buffer fills up). 
          
       If   the   following   messages   show  up,  something  is
       dreadfully wrong:
          a)  "Illegal default separator"
          b)  "Block buffer overflow"

AUTHORS
       Debbie Scherrer (Lawrence Berkeley Laboratory)

BUGS
       An expression may not start with a minus sign (-). 
       
       Regular expressions can not span line boundaries. 




























                               -2-


