HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)
b
bfs(1) bfs(1)
NAME
bfs - big file scanner
SYNOPSIS
bfs [-] name
DESCRIPTION
bfs is similar to ed except that it is read-only (see ed(1))
bfs can handle files with up to 32K − 1 lines;
each line can contain up to 512 characters, including the new-line character.
bfs is usually more efficient
than
ed for scanning a file, since the file is not copied to a buffer. Historically, this command was most
useful for identifying sections of a large file where
csplit could be used to divide it into more manage-
able pieces for editing (see csplit(1)). However, most editors now support files larger than the above-
mentioned limits.
Normally, the size of the file being scanned is printed, as is the size of any file written with the
w com-
mand. The optional
- suppresses printing of sizes. Input is prompted with
* if P and a carriage-return
are typed, as in
ed. Prompting can be turned off again by inputting another
P
and pressing Return. Note
that messages are given in response to errors if prompting is turned on.
bfs supports the Basic Regular Expression (RE) syntax (see regexp(5)) with the addition that a null
RE
(e.g., //) is equivalent to the last RE encountered. All address expressions described under ed are sup-
ported. In addition, regular expressions can be surrounded with two symbols besides
/ and ?:
> indi-
cates downward search without wrap-around, and
< indicates upward search without wrap-around. There
is a slight difference in mark names: only the letters a through z can be used, and all 26 marks are
remembered.
The
e, g, v, k, n, p, q, w,
=, ! and null commands operate as described under ed. Commands such as -
--
, +++-, +++=, -12, and +4p are accepted. Note that 1,10p and
1,10 both print the first ten
lines. The
f command only prints the name of the file being scanned; there is no remembered file name.
The
w command is independent of output diversion, truncation, or crunching (see the xo, xt
, and xc
commands, below). The following additional commands are available:
xf file Further commands are taken from the named file. When an end-of-file is reached, an inter-
rupt signal is received or an error occurs, reading resumes with the file containing the
xf.
Xf commands may be nested to a depth of 10.
xo [ file ] Further output from the p and null commands is diverted to the named file, which, if
necessary, is created mode 666. If file is missing, output is diverted to the standard output.
Note that each diversion causes truncation or creation of the file.
: label This positions a label in a command file. label is terminated by a new-line, and blanks
between the : and the start of label are ignored. This command can also be used to insert
comments into a command file, since labels need not be referenced.
(.,.)xb/regular expression/label
A jump (either upward or downward) is made to label if the command succeeds. It fails
under any of the following conditions:
1. Either address is not between 1 and $.
2. The second address is less than the first.
3. The regular expression does not match at least one line in the specified range,
including the first and last lines.
On success,
. is set to the line matched and a jump is made to label. This command is the
only one that does not issue an error message on bad addresses. Thus it can be used to test
whether addresses are bad before other commands are executed. Note that the command
xb/label
is an unconditional jump.
The xb command is allowed only if it is read from someplace other than a terminal. If it is
read from a pipe only a downward jump is possible.
xn List the marks currently in use (marks are set by the k command).
xt number Output from the p and null commands is truncated to at most number characters. The ini-
tial number is 255.
Section 1−−46 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005