nl(1) nl(1)
NAME
nl - number lines
SYNOPSIS
nl [-btype] [-ftype] [-htype] [-vstart#] [-iincr] [-p] [-lnum]
[-ssep] [-wwidth] [-nformat] [-ddelim] [file]
DESCRIPTION
nl reads lines from the named file, or the standard input if
no file is named, and reproduces the lines on the standard
output. Lines are numbered on the left in accordance with the
command options in effect. nl processes supplementary code
set characters according to the locale specified in the
LC_CTYPE environment variable [see LANG on environ(5)], except
as noted below. In regular expressions, pattern searches are
performed on characters, not bytes, as described on grep(1).
nl views the text it reads in terms of logical pages. Line
numbering is reset at the start of each logical page. A
logical page consists of a header, a body, and a footer
section. Empty sections are valid. Different line numbering
options are independently available for header, body, and
footer. For example, -bt (the default) numbers non-blank
lines in the body section and does not number any lines in the
header and footer sections.
The start of logical page sections are signaled by input lines
containing nothing but the following delimiter character(s):
Line contents Start of
\:\:\: header
\:\: body
\: footer
Unless optioned otherwise, nl assumes the text being read is
in a single logical page body.
Command options may appear in any order and may be
intermingled with an optional file name. Only one file may be
named.
If POSIX.2 is in the environment, then there is no default
value for the options -b, -f, -h, -v, -i, -l, -s, -w, -n or
-d. If the value isn't immediately after the option variable,
Copyright 1994 Novell, Inc. Page 1
nl(1) nl(1)
then it is the next argument.
The options are:
-btype Specifies which logical page body lines are to be
numbered. Recognized types and their meanings are:
a number all lines
t number lines with printable text only
n do not number lines
pexp number only lines that contain the basic
regular expression (BRE) exp [see grep(1)]
Default type for logical page body is t (text lines
numbered). All supplementary code set characters
are considered printable.
-ftype Same as -btype except for footer. Default type for
logical page footer is n (no lines numbered). All
supplementary code set characters are considered
printable.
-htype Same as -btype except for header. Default type for
logical page header is n (no lines numbered). All
supplementary code set characters are considered
printable.
-vstart# start# is the initial value used to number logical
page lines. Default start# is 1.
-iincr incr is the increment value used to number logical
page lines. Default incr is 1.
-p Do not restart numbering at logical page delimiters.
-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). Default num is
1.
Copyright 1994 Novell, Inc. Page 2
nl(1) nl(1)
-ssep sep is the character(s) used in separating the line
number and the corresponding text line. Default sep
is a tab. sep must be a single-byte character or
characters.
-wwidth width is the number of characters to be used for the
line number. Default width is 6. The maximum for
width is 100. If a number greater than the maximum
is specified for width, the maximum is automatically
used.
-nformat format is the line numbering format. Recognized
values are: ln, left justified, leading zeroes
suppressed; rn, right justified, leading zeroes
suppressed; rz, right justified, leading zeroes
kept. Default format is rn (right justified).
-ddelim The two 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. delim must be a single-byte character
or characters.
EXAMPLES
The command:
nl -v10 -i10 -d!+ file1
will cause the first line of the page body to be numbered 10,
the second line of the page body to be numbered 20, the third
30, and so forth. The logical page delimiters are !+.
FILES
/usr/lib/locale/locale/LC_MESSAGES/uxdfm
language-specific message file [See LANG on environ(5).]
REFERENCES
ed(1), pr(1)
Copyright 1994 Novell, Inc. Page 3