BFS(1)

NAME
bfs - big file scanner

SYNOPSIS
bfs [-] name

DESCRIPTION
bfs is a read-only variant of ed(1). Since it has no editing buffer, it consumes no space for a temporary file and needs less time while reading the file initially. Also bfs can process slightly larger files on machines with 32-bit addressing.

With the - argument, no character counts are printed. name specifies the file to be scanned.

bfs supports simple regular expressions and addressing as ed. The terminating `/' and `?' characters around regular expressions must not be omitted. Additional addressing modes are

>regex>
    which stops at the next line matching regex without wrap-around, and

<regex<
    which stops at the first previous line matching regex without wrap-around.

The following commands are available (default addresses are shown as in ed(1)):

e name
    Changes the currently scanned file to name.

f   Prints the name of the currently scanned file.

(1,$)g/regular expression/command list
    Executes command list for each line in the range that matches the regular expression given.

(.)kx
    Marks the given line with the lower-case letter x for further addressing with `′x'.

(.,.)p
    Prints the given range of lines to standard output.

P   Toggles the prompt `*' and more verbose error messages on and off.

q   Quits the bfs command.

(1,$)v/regular expression/command list
    Executes command list for each line in the range that does not match the regular expression given.

(1,$)w name
    Writes the current file to another file name.

(.,.)xb/regular expression/label
    A match for regular expression is searched within the range of lines; if it is found, execution continues at label. This command is not available when input is read from a terminal; if input comes from a pipe, only labels that are set after the location of this command can be used.

xb[z|n] label
    If the command suffix is z and the last executed shell command returned zero, or if the suffix is n and the shell command returned non-zero, execution continues at label.

xc [0|1]
    Toggles or sets line crunching. If enabled, the output of the p and <newline> commands is modified such that tabs or successive spaces are replaced by single spaces, and empty lines are discarded.

xf name
    Reads command input from the file name. xf commands may be nested. On end-of-file or error, execution continues at the next upper nesting level.

xn  Lists the marks previously set by the k command.

xo [name]
    Redirects the output of the p and <newline> commands to the file name. If no name is given, output is written to the standard output as usual.

xt number
    Causes each line printed with the p and <newline> commands to be truncated after a width of number character positions has been reached. By default, lines are not truncated.

xv[digit][!]string
    Sets the value of the 0th to 9th variable to string; if the initial ! is present, string is interpreted as a shell command once, and the first line of its output is assigned. Variables can be referenced anywhere in command input as %0 to %9.

($)=
    Prints the line number of the given line.

!shell command
    Executes the given shell command.

:label
    Sets a label for command input.

The size limit for the files which bfs can display depends on the number of lines that fit in core; each line takes 2 words.

If a line contains a NUL character, regular expressions cannot match beyond it, but the entire line is written with the p and w commands.

ENVIRONMENT VARIABLES

LANG, LC_ALL
    See locale(7).

LC_CTYPE
    Determines the mapping of bytes to characters in regular expressions and with the xt command.

SEE ALSO
ed(1)