NAME
nl — line numbering filter
SYNOPSIS
nl
[-b
type]
[-h
type]
[-f
type]
[-p]
[-v
start#]
[-i
incr]
[-s
sep]
[-w
width]
[-n
format]
[-l
num]
[-d
delim]
[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
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 (e.g., no numbering of header and footer
lines while numbering blank lines only in the body).
The start of logical page sections are signaled by input
lines containing nothing but the following delimiter character(s):
Unless told otherwise,
nl
assumes the text being read is in a single logical page body.
Command options can appear in any order and
can be intermingled with an optional file name.
Only one file can be named.
nl
recognizes the following options:
- -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
no line numbering;
- pstring
number only lines that contain the regular expression
specified in
string.
Basic Regular Expression syntax is supported (see
regexp(5)).
The default
type
for logical page body is
t
(text lines numbered).
- -htype
Same as
-btype
except for header.
Default
type
for logical page header is
n
(no lines numbered).
- -ftype
Same as
-btype
except for footer.
Default for logical page footer is
n
(no lines numbered).
- -p
Do not restart numbering at logical page delimiters.
- -vstart#
start#
is the initial value used to number logical page lines.
Default is
1.
- -iincr
incr
is the increment value used to number logical page lines.
Default is
1.
- -ssep
sep
is the character or characters used in separating the line number
and the corresponding text line.
Default
sep
is a tab.
- -wwidth
width
is the number of character columns to be used for the line number.
Default
width
is
6.
- -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).
- -lnum
num
is the number of consecutive blank lines
to be treated and numbered as a single line.
For example,
-l3
results in every third adjacent blank line being numbered
if the appropriate
-ha,
-ba,
and/or
-fa
option is set.
Default is
1.
- -dxx
The delimiter characters specifying the start of a logical page
section can 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, however, this restriction is not there for
UNIX
Standard
(see
standards(5))
compliant
nl.
To define a backslash as the delimiter, use two backslashes.
EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see
standards(5).
Environment Variables
LC_COLLATE
determines the collating sequence used
in evaluating regular expressions.
LC_CTYPE
determines the characters matched
by character class expressions in regular expressions.
If
LC_COLLATE
or
LC_CTYPE
is not specified in the environment
or is set to the empty string, the value of
LANG
is used as a default for each unspecified or empty variable. If
LANG
is not specified or is set to the empty string, a default of
"C" (see
lang(5))
is used instead of
LANG.
If any internationalization variable contains an invalid setting,
nl
behaves as if all internationalization variables are set to "C".
See
environ(5).
International Code Set Support
Single-byte character code sets are supported.
EXAMPLES
Number
file1
starting at line number 10, using an increment of ten.
The logical page delimiters are
!
and
+:
STANDARDS CONFORMANCE
nl: SVID2, SVID3, XPG2, XPG3, XPG4