BSD 2.11 - man page for bm (bsd section 1)
|Linux & Unix Commands - Search Man Pages
bm - search a file for a string
/usr/public/bm [ option ] ... [ strings ] [ file ]
Bm searches the input files (standard input default) for lines matching a string. Nor-
mally, 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 expressions. Bm is also case sensitive. The following options are
-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
The string is the next argument after the -e flag. This allows strings beginning
-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
-s Silent mode. Nothing is printed (except error messages). This is useful for
checking the error status.
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 pat-
Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors or inaccessible
Peter Bain (pdbain@wateng), with modifications suggested by John Gilmore
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.
4th Berkeley Distribution 8 July 1985 BM(PUBLIC)
All times are GMT -4. The time now is 02:55 AM.