BM(PUBLIC)	    UNIX Programmer's Manual	       BM(PUBLIC)


NAME
     bm - search a file for a string

SYNOPSIS
     /usr/public/bm [ option ] ...  [ strings ] [ file ]

DESCRIPTION
     Bm searches the input files (standard input default) for
     lines matching a string.  Normally, each line found is
     copied to the standard output.  It is blindingly fast.  Bm
     strings are fixed sequences of characters: there are no
     wildcards, repetitions, or other features of regular expres-
     sions.  Bm is also case sensitive.  The following options
     are recognized.

     -x   (Exact) only lines matched in their entirety are
	  printed

     -l   The names of files with matching lines are listed
	  (once) separated by newlines.

     -c   Only a count of the number of matches is printed

     -e string
	  The string is the next argument after the -e flag. This
	  allows strings beginning with '-'.

     -h   No filenames are printed, even if multiple files are
	  searched.

     -n   Each line is preceded by the number of characters from
	  the beginning of the file to the match.

     -s   Silent mode.	Nothing is printed (except error mes-
	  sages).  This is useful for checking the error status.

     -f file
	  The string list is taken from the file.

     Unless the -h option is specified the file name is shown if
     there is more than one input file.  Care should be taken
     when using the characters $ * [ ^ | ( ) and \ in the strings
     (listed on the command line) as they are also meaningful to
     the Shell.  It is safest to enclose the entire expression
     argument in single quotes ' '.

     Bm searches for lines that contain one of the (newline-
     separated) strings, using the Boyer-Moore algorithm.  It is
     far superior in terms of speed to the grep (egrep, fgrep)
     family of pattern matchers for fixed-pattern searching, and
     its speed increases with pattern length.


Printed 11/24/99	   8 July 1985				1


BM(PUBLIC)	    UNIX Programmer's Manual	       BM(PUBLIC)


SEE ALSO
     grep(1)

DIAGNOSTICS
     Exit status is 0 if any matches are found, 1 if none, 2 for
     syntax errors or inaccessible files.

AUTHOR
     Peter Bain (pdbain@wateng), with modifications suggested by
     John Gilmore

BUGS
     Only 100 patterns are allowed.

     Patterns may not contain newlines.

     If a line (delimited by newlines, and the beginning and end
     of the file) is longer than 8000 charcters (e.g. in a core
     dump), it will not be completely printed.

     If multiple patterns are specified, the order of the ouput
     lines is not necessarily the same as the order of the input
     lines.

     A line will be printed once for each different string on
     that line.

     The algorithm cannot count lines.

     The -n and -c work differently from fgrep.

     The -v, -i, and -b are not available.


Printed 11/24/99	   8 July 1985				2


 
Generated: 2016-12-26
Generated by man2html V0.25
page hit count: 1520
Valid CSS Valid XHTML 1.0 Strict