Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nl

v(uutils coreutils) 0.1.0

Options

--help

nl-help-help

--body-numbering=<STYLE>, -b <STYLE>

nl-help-body-numbering

--section-delimiter=<CC>, -d <CC>

nl-help-section-delimiter

--footer-numbering=<STYLE>, -f <STYLE>

nl-help-footer-numbering

--header-numbering=<STYLE>, -h <STYLE>

nl-help-header-numbering

--line-increment=<NUMBER>, -i <NUMBER>

nl-help-line-increment

--join-blank-lines=<NUMBER>, -l <NUMBER>

nl-help-join-blank-lines

--number-format=<FORMAT>, -n <FORMAT>

nl-help-number-format

--no-renumber, -p

nl-help-no-renumber

--number-separator=<STRING>, -s <STRING>

nl-help-number-separator

--starting-line-number=<NUMBER>, -v <NUMBER>

nl-help-starting-line-number

--number-width=<NUMBER>, -w <NUMBER>

nl-help-number-width

Examples

Number non-blank lines in a file:

nl {{path/to/file}}

Read from stdin:

{{command}} | nl -

Number [a]ll [b]ody lines including blank lines or do [n]ot number [b]ody lines:

nl -b {{a|n}} {{path/to/file}}

Number only the [b]ody lines that match a basic regex (BRE) [p]attern:

nl -b p'FooBar[0-9]' {{path/to/file}}

Use a specific [i]ncrement for line numbering:

nl -i {{increment}} {{path/to/file}}

Specify the line numbering format to [r]ight or [l]eft justified, keeping leading [z]eros or [n]ot:

nl -n {{rz|ln|rn}}

Specify the line numbering's [w]idth (6 by default):

nl -w {{col_width}} {{path/to/file}}

Use a specific string to [s]eparate the line numbers from the lines (TAB by default):

nl -s {{separator}} {{path/to/file}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.