nl[options] [file]
Number the lines of file in logical page segments.
Numbering resets to 1 at the start of each page.
typeNumber lines according to type. Values are:
| a | All lines. |
| n | No lines. |
| t | Text lines only (the default). |
p"exp" | Lines containing |
xyUse characters xy to delimit logical pages (default is \:).
typeLike -b but number footer (default type is n).
typeLike -b but number header (default type is n).
nIncrement each line number by n (default is 1).
nCount n consecutive blank lines as one line.
formatSet line number format. Values are:
Left justify, omit leading zeros.
Right justify, omit leading zeros (default).
Right justify.
Do not reset numbering at start of pages.
cSeparate text from line number with character(s) c
(default is a tab).
nNumber each page starting at n (default is 1).
nUse n columns to show line number (default is 6).
List the current directory, numbering files as 1), 2), etc.:
ls | nl -w3 -s') '
Number C source code and save it:
nl prog.c > print_prog
Number only lines that begin with #include:
nl -bp"^#include" prog.c