NL(1)

NAME
nl - line numbering filter

SYNOPSIS
nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i num] [-l num] [-n format] [-s sep] [-v num] [-w num] [file]

DESCRIPTION
nl reads lines from file and writes them to stdout, numbering non-empty lines. If no file is given nl reads from stdin.

nl treats the input text as a collection of logical pages divided into logical page sections. Each logical page consists of a header section, a body section and a footer section. Sections may be empty. The start of each section is indicated by a single delimiting line, one of:
Line | Start of
\:\:\: header
\:\: body
\: footer

If the input text contains no delimiting line then all of the input text belongs to a single logical page body section.

OPTIONS

-p  Do not reset line number for logical pages.

-h type | -b type | -f type
    Define which lines to number in the head | body | footer section:

    a   All lines.

    n   No lines.

    t   Only non-empty lines. This is the default.

    pexpr
        Only lines matching expr according to regex(7).

-d delim
    Set delim as the delimiter for logical pages. If delim is only one character, nl appends ":" to it. The default is "\:".

-i num
    Set the increment between numbered lines to num.

-l num
    Set the number of adjacent blank lines to be considered as one to num. The default is 1.

-n format
    Set the line number output format to one of:

    ln  Left justified.

    rn  Right justified. This is the default.

    rz  Right justified with leading zeroes.

-s sep
    Use sep to separate line numbers and lines. The default is "\t".

-v num
    Start counting lines from num. The default is 1.

-w num
    Set the width of the line number to num. The default is 6.

SEE ALSO
pr(1)

STANDARDS
The nl utility is compliant with the p1003.1-2013 specification.