NL(1V)

NAME
nl - line numbering filter

SYNOPSIS
nl [ -p ] [ ] [ -btype ] [ -ftype ] [ -vstart ] [ -iincr ] [ -lnum ] [ -ssep ] [ -wwidth ] [ -nfmt ] [ -ddelim ] filename

AVAILABILITY
This command is available with the System V software installation option. Refer to for information on how to install optional software.

DESCRIPTION
nl reads lines from filename (or the standard input), numbers them according to the options in effect, and sends its output to the standard output.

nl views the text it reads in terms of logical pages. Line numbering is normally reset at the start of each page. A logical page is composed of header, body and footer sections. The start of each page section is signaled by input lines containing section delimiters only:

        Start of file

        \:\:\:
        header

        \:\:
        body

        \:
        footer

Empty sections are valid. Different line-numbering options are available within each section. The default scheme is no numbering for headers and footers.

OPTIONS

-p  Do not restart numbering at logical page delimiters.

-btype
    Specify which logical page body lines are to be numbered. type is one of:
    a   number all lines
    t   number lines with printable text only (the default)
    n   no line numbering
    p rexp
        number only lines that contain the regular expression rexp

-htype
    Same as -btype except for the header. The default type for the logical page header is n (no lines numbered).

-ftype
    Same as -btype except for the footer. The default for logical page footer is n (no lines numbered).

-vstart
    start is the initial value used to number logical page lines. The default is 1.

-iincr
    incr is the increment by which to number logical page lines. The default is 1.

-ssep
    sep is the character(s) used to separate the line number from the corresponding text line. The default is a TAB.

-wwidth
    width is the number of characters to be used for the line-number field. The default is 6.

-nfmt
    fmt is the line numbering format. Recognized values are:
    rn  right justified, leading zeroes suppressed (the default)
    ln  left justified, leading zeroes suppressed
    rz  right justified, leading zeroes kept

-lnum
    num is the number of blank lines to be considered as one. For example, -l2 results in only the second adjacent blank being numbered (if the appropriate -ha, -ba, and/or -fa option is set). The default is 1.

-dxx
    The delimiter characters specifying the start of a logical page section may be changed from the default characters (\:) to two user-specified characters. If only one character is entered, the second character remains the default character (:). No space should appear between the -d and the delimiter characters. To enter a backslash, use two backslashes.

EXAMPLE
The command:

    nl -v10 -i10 -d!+ filename1

will number filename1 starting at line number 10 with an increment of ten. The logical page delimiters are !+.

SEE ALSO
pr(1V)