

            ffind (1) --- look for a string (kmp style)              08/27/84


          | _U_s_a_g_e

          |      ffind <string> { -{<option>} } { <file_spec> }
          |         <option> ::=  c | i | l | o[<occurrences>] | v | x
          |         <file_spec> ::= <filename> | -[<stdin_number>] |
          |                           -n(<stdin_number>|<filename>)


          | _D_e_s_c_r_i_p_t_i_o_n

          |      'Ffind  is  a  filter  that  selects  lines matching a given
          |      string from the named files (or standard input if  no  files
          |      are  specified)  and copies them to standard output.  Unlike
          |      'find', 'ffind' cannot match the standard Subsystem patterns
          |      but will match only a _l_i_t_e_r_a_l string.   The  algorithm  used
          |      (Knuth,  Morris,  and  Pratt)  is very fast and is typically
          |      four to fives times faster than 'find'.

          |      The available options are:

          |           -c   If the "c" option is used, only  a  count  of  the
          |                lines that matched (differed) is printed.

          |           -i   If  the "i" option is used, the case of the string
          |                and the text of the search file(s) is ignored.

          |           -l   If the "l" option is used, each  line  printed  is
          |                preceded  by  its  relative line number within the
          |                file from which it was read.

          |           -o   If the "o" option is used, 'ffind' will quit sear-
          |                ching the current file after <occurrences>  match-
          |                ing  (differing)  lines have been found in it, and
          |                will continue with  the  next  file.   If  "o"  is
          |                specified  but  <occurrences> is omitted, only the
          |                first occurrence is found.

          |           -v   If the "v" option is specified, each line of  out-
          |                put  is  labelled  with the name of the input file
          |                from which the line was read.

          |           -x   If the "x" option is used, only lines that do  not
          |                match the string are printed.

          |      The  remaining  command line arguments are taken as names of
          |      files to be searched for the string.  The full syntax of the
          |      <file_spec> argument is described in  the  entry  for  'cat'
          |      (1).


          | _E_x_a_m_p_l_e_s

          |      lf -c | ffind .r
          |      guide -p sh | ffind the -ci




            ffind (1)                     - 1 -                     ffind (1)




            ffind (1) --- look for a string (kmp style)              08/27/84


          | _M_e_s_s_a_g_e_s

          |      "Usage:  ffind ..."  for bad arguments.
          |      "file:  can't open" for unreadable files.


          | _S_e_e _A_l_s_o

          |      cat (1), change (1), find (1)

          |      Knuth,  D.E.,  J.H.   Morris,  Jr.,  and V.R.  Pratt (1977).
          |      "Fast pattern matching in strings."  SIAM Journal on Comput-
          |      ing 6 (No.  2):  240-267.













































            ffind (1)                     - 2 -                     ffind (1)


