nl(1)nl(1)Namenl - line numbering filter
Syntaxnl [-h type] [-b type] [-f type] [-v start#] [-i incr] [-p ] [-l num]
[-s sep] [-w width] [-n format] [-d delim] file
Description
The command reads lines from the named file or from the standard input,
if no file is named, and reproduces the lines on the standard output.
Lines are numbered on the left in accordance with the command options
in effect.
The command views the text it reads in terms of logical pages. Line
numbering is reset at the start of each logical page. A logical page
consists of a header, a body, and a footer section. Empty sections are
valid. Different line numbering options are independently available
for header, body, and footer. For example, you can elect not to number
header and footer lines while numbering blank lines in the body.
The start of logical page sections is signaled by input lines contain‐
ing nothing but the following delimiter characters:
Line contents Start of
\:\:\: header
\:\: body
\: footer
Unless otherwise specified, assumes that the text it is reading is in
the body of a single logical page.
Options
Command options may appear in any order and may be intermingled with an
optional file name. Only one file may be named.
-b type Specifies which logical page body lines are to be
numbered. The following are recognized types and
their meaning: a, number all lines; t, number lines
with printable text only; n, no line numbering;
pstring, number only lines that contain the regular
expression specified in string.
The default type for logical page body is t (text
lines numbered).
-h type Same as -b type except for header. Default type
for logical page header is n (no lines numbered).
-f type Same as -b type except for footer. Default for
logical page footer is n (no lines numbered).
-p Do not restart numbering at logical page delim‐
iters.
-v start# The initial value used to number logical page
lines. Default is 1.
-i incr The increment value used to number logical page
lines. Default is 1.
-s sep The character used in separating the line number
and the corresponding text line. Default sep is a
tab.
-w width The number of characters used for the line number.
Default width is 6.
-n format The line numbering format. Recognized values are
the following: ln, left justified, leading zeroes
suppressed; rn, right justified, leading zeroes
suppressed; rz, right justified, leading zeroes
kept. Default format is rn (right justified).
-l num The number of blank lines to be considered as one.
For example, -l2 results in only the second adja‐
cent blank being numbered (if the appropriate -ha,
-ba, or -fa option is set). Default is 1.
-d xx The delimiter characters specifying the start of a
logical page section may be changed from the
default characters (\:) to two user-specified char‐
acters. If only one character is entered, the sec‐
ond character remains the default character (:).
No space should appear between the -d and the
delimiter characters. To enter a backslash, you
must type two backslashes (//).
Examplesnl-v10 -i10 -d!+ file1
This command numbers file1 starting at line number 10 with an increment
of ten. The logical page delimiters are !+.
See Alsopr(1)nl(1)