nl — stdin stdout - file -- opt --help --version
nl copies its files to
standard output, prepending line numbers.
$ nl myfile 1 Once upon a time, there was 2 a little operating system named 3 Linux, which everybody loved.
It’s more flexible than
-b options, providing an almost bizarre
amount of control over the numbering.
nl can be used in two ways: on ordinary
text files, and on specially marked-up text files with predefined
headers and footers.
Prepend numbers to
all lines (
Begin numbering with
Increment the number
Format numbers as
Force the width of
the number to be
nl has the
wacky ability to divide text files into virtual pages, each with a
header, body, and footer with different numbering schemes. For this
to work, however, you must insert
nl-specific delimiter strings into the
file, such as
\:\:\: (start of
\:\: (start of body), and
\: (start of footer). Each must appear on a line by itself. Then ...