The nl(1) utility reads lines from standard input or from
file and writes those lines to standard output, with line
numbers added on the left.
The input text is treated in terms of logical pages
Line numbers restart at the beginning of each logical page. A
logical page contains a header, a body, and a footer, any of which
can be empty. Each section of a logical page can have its own
numbering. For instance, headers can have no numbers; blank lines,
however, are numbered in the body, but not in the footer.
The sections of a logical page are indicated by the following
delimiters, which occur alone on an input line:
Line
Start of
\:\:\:
header
\:\:
body
\:
footer
By default, a file contains only one logical page body.
The nl(1) utility takes the following options:
-btype
Specify the logical body lines to be numbered. Values for
type are:
a
All lines are numbered.
n
No line numbering.
pregexp
Number only the lines containing the specified regular
expression regexp.
t
Number only lines consisting entirely of text characters
classified as graph characters in the current locale.
-ddelim
Set the delimiter characters from \: to the one or two
characters specified by delim. If only one character is
specified, the second is a colon (:).
-ftype
Specify the logical footer to be numbered. The values of
type are the same as for -b.
-htype
Specify numbering for the logical header section. The values of
type are the same as for -b.
-iincr
Increment the numbers of the logical page lines by incr.
The default is 1.
-lnum
Treat num blank lines as 1. The default is 1. A value of
-l 3 means that only the third adjacent blank line is
numbered if the logical section has numbering turned on.
-nformat
Number the lines in the specified format. Values for
format are:
ln
Left justified with leading zeroes suppressed.
rn
Right justified with leading zeroes suppressed. This is the
default.
rz
Right justified with leading zeroes retained.
-p
Preserve numbering; do not restart it at logical page
delimiters.
-ssep
Separate the line number and the text characters by the
characters in the string sep. The default value of
sep is a tab character.
-vstartnum
Begin numbering logical page lines with the value
startnum. The default is 1.
-wwidth
Use width characters for the line number. The default is
6.