Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (m - o) nl(1)
-n format
Specifies format as the line-numbering format. Recognized formats are:
ln Left justified, leading zeros are suppressed
rn Right justified, leading zeros are suppressed (the default value)
rz Right justified, leading zeros are kept
-p Ignores logical page delimiters (does not restart numbering).
-s[separator ]
Separates text from line numbers with the separator string. The default value of
separator is a tab character.
-v number
Sets the initial logical page line number to number. The default value of number is 1.
-w number
Specifies number as the number of digits in the line number. The default value of
number is 6.
DESCRIPTION
The nl command reads file (the standard input file by default), numbers the lines in the input, and
writes the numbered lines to the standard output file.
In the output, nl numbers the lines on the left, according to the flags you specify on the command
line.
The input text must be written in logical pages. Each logical page has a header, a body, and a
footer section (sections can be empty). Unless you use the -p flag, nl resets the line numbers at
the start of each logical page. You can set line-numbering flags independently for the header,
body, and footer sections (for example, no numbering of header and footer lines while numbering
text lines only in the body).
Signal the start of logical page sections with lines in file that contain nothing but the following
delimiter characters:
Line Contents Start of
\:\:\: Header
\:\: Body
\: Footer
If file contains none of these lines, then the entire file is considered the body.
You can name only one file on the command line. You can list the flags and the filename in any
order.
Unless otherwise specified, nl assumes the text being read is in a single logical page body.
EXAMPLES
1. To number only the nonblank lines in the file chap1,enter:
nl chap1
This displays a numbered listing of chap1, numbering only the nonblank lines in the
body sections by default. If chap1 contains no \:\:\:, \:\:,or\: delimiters, then the entire
file is considered the body.
527188-004 Hewlett-Packard Company 6−39