BFS(1) DOMAIN/IX Reference Manual (SYS5) BFS(1)
NAME
bfs - big file scanner
USAGE
bfs [-] name
DESCRIPTION
Bfs is similar to ed (1), except that it is read-only and
processes much larger files. Maximum file size is 1024K
bytes. Files can be up to 32K lines in length, with as many
as 512 characters per line, including newline (255 charac-
ters for 16-bit machines). Bfs is usually more efficient
than ed (1) for scanning a file, since the file is not
copied to a buffer. It is most useful for identifying sec-
tions of a large file where csplit (1) can be used to divide
it into more manageable pieces for editing.
Unless you specify a dash (-) option, bfs prints the size of
the file being scanned. If P and a carriage return are
typed, it prompts input with an asterisk (*). Prompting can
be turned off again by inputting another P and carriage
return. Note that messages are given in response to errors
if prompting is turned on.
EXPRESSIONS
Bfs supports all address expressions described under ed (1).
Thus, regular expressions may be surrounded with a slash (/)
and question mark (?). In addition, a greater-than charac-
ter (>) indicates a downward search without wrap-around, and
a less-than character (<) indicates an upward search without
wrap-around. There is a slight difference in mark names:
only the letters a through z may be used, and all 26 marks
are remembered.
COMMANDS
The e, g, k, p, q, v, w, =, ! and null commands operate as
described under ed (1). Commands such as - - - , +++-,
+++=, -12, and +4p are accepted. Note that 1,10p and 1,10
will both print the first ten lines. The f command only
prints the name of the file being scanned; there is no
remembered filename. The w command is independent of output
diversion, truncation, or crunching (see the xo, xt, and xc
commands below). The following commands are also available:
xf file
Take further commands from the named file. When
an end-of-file is reached, an interrupt signal is
received, or an error occurs, reading resumes with
the file containing the xf. The xf commands may
be nested to a depth of ten.
xn List the marks currently in use (marks are set by
Printed 6/10/85 BFS-1
BFS(1) DOMAIN/IX Reference Manual (SYS5) BFS(1)
the k command).
xo [file]
Divert further output from the p and null commands
to the named file, which, if necessary, is created
in mode 666. If file is missing, divert output to
the standard output. Each diversion truncates or
creates a file.
: label
Position a label in a command file. Ignore blanks
between the colon (:) and the start of the label.
Terminate label with newline. May also be used to
insert comments into a command file, since labels
need not be referenced.
( . , . )xb/regular expression/label
Make a jump (either upward or downward) to label
if successful. Will fail under any of the follow-
ing conditions:
1. Neither address is 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.
If successful, set the current line, indicated by
a period (.), to the line matched. Then, jump to
label. This command is the only one that does not
issue an error message on bad addresses, so it may
be used to test whether addresses are bad before
other commands are executed. Note that 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 possi-
ble.
xt number
Truncate output from the p and null commands to a
maximum of number characters (initially 255).
xv[digit][spaces][value]
Specify digit as the variable name following xv.
The commands xv5100 or xv5 100 both assign the
value 100 to the variable 5. The command
Xv61,100p assigns the value 1,100p to the variable
6. To reference a variable, put a percent sign
(%) in front of the variable name. For example,
BFS-2 Printed 6/10/85
BFS(1) DOMAIN/IX Reference Manual (SYS5) BFS(1)
using the above assignments for variables 5 and 6:
1,%5p
1,%5
%6
all print the first 100 lines.
To globally search for the characters 100 and
print each line containing a match, type:
g/%5/p
To escape the special meaning of a percent sign
(%), a backslash (\) must precede it.
The following can be used to match and list lines
containing printf of characters, decimal integers,
or strings:
g/".*\%[cds]/p
Another feature of the xv command is that the
first line of output from a UNIX system command
can be stored into a variable. The only require-
ment is that the first character of value be an
exclamation point (!). For example:
.w junk
xv5!cat junk
!rm junk
!echo ``%5''
xv6!expr %6 + 1
puts the current line into variable 5, prints it,
and increments the variable 6 by one. To escape
the special meaning of an exclamation point (!) as
the first character of value, precede it with a
slash (\).
xv7\!date
stores the value !date into variable 7.
xbz label
xbn label
Test the last saved return code from the execution
of a UNIX system command (!command) or non-zero
value, respectively, to the specified label. For
example, to search for the next five lines con-
taining the string called ``size'', you might do
the following:
Printed 6/10/85 BFS-3
BFS(1) DOMAIN/IX Reference Manual (SYS5) BFS(1)
xv55
: l
/size/
xv5!expr %5 - 1
!if 0%5 != 0 exit 2
xbn l
xv45
: l
/size/
xv4!expr %4 - 1
!if 0%4 = 0 exit 2
xbz l
xc [switch]
If switch is 1, output from the p and null com-
mands is crunched; if switch is 0 it is not.
Without an argument, xc reverses switch. Ini-
tially switch is set for no crunching. Crunched
output has strings of tabs and blanks reduced to
one blank and blank lines suppressed.
DIAGNOSTICS
? for errors in commands, if prompting is turned off.
Self-explanatory error messages when prompting is on.
RELATED INFORMATION
csplit (1), ed (1), regcmp (3X).
BFS-4 Printed 6/10/85