nl(1) [ultrix man page]
nl(1) General Commands Manual nl(1) Name nl - line numbering filter Syntax nl [-h type] [-b type] [-f type] [-v start#] [-i incr] [-p ] [-l num] [-s sep] [-w width] [-n format] [-d delim] file Description The command reads lines from the named file or from the standard input, if no file is named, and reproduces the lines on the standard out- put. Lines are numbered on the left in accordance with the command options in effect. The command 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 avail- able for header, body, and footer. For example, you can elect not to number header and footer lines while numbering blank lines in the body. The start of logical page sections is signaled by input lines containing nothing but the following delimiter characters: Line contents Start of ::: header :: body : footer Unless otherwise specified, assumes that the text it is reading is in the body of a single logical page. Options Command options may appear in any order and may be intermingled with an optional file name. Only one file may be named. -b type Specifies which logical page body lines are to be numbered. The following are recognized types and their meaning: a, number all lines; t, number lines with printable text only; n, no line numbering; pstring, number only lines that con- tain the regular expression specified in string. The default type for logical page body is t (text lines numbered). -h type Same as -b type except for header. Default type for logical page header is n (no lines numbered). -f type Same as -b type except for footer. Default for logical page footer is n (no lines numbered). -p Do not restart numbering at logical page delimiters. -v start# The initial value used to number logical page lines. Default is 1. -i incr The increment value used to number logical page lines. Default is 1. -s sep The character used in separating the line number and the corresponding text line. Default sep is a tab. -w width The number of characters used for the line number. Default width is 6. -n format The line numbering format. Recognized values are the following: ln, left justified, leading zeroes suppressed; rn, right justified, leading zeroes suppressed; rz, right justified, leading zeroes kept. Default format is rn (right jus- tified). -l num 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, or -fa option is set). Default is 1. -d xx 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, you must type two backslashes (//). Examples nl -v10 -i10 -d!+ file1 This command numbers file1 starting at line number 10 with an increment of ten. The logical page delimiters are !+. See Also pr(1) nl(1)
Check Out this Related Man Page
NL(1) BSD General Commands Manual NL(1) NAME
nl -- line numbering filter SYNOPSIS
nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num] [-n format] [-s sep] [-v startnum] [-w width] [file] DESCRIPTION
The nl utility reads lines from the named file or the standard input if the file argument is ommitted, applies a configurable line numbering filter operation and writes the result to the standard output. The nl utility treats the text it reads in terms of logical pages. Unless specified otherwise, 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 sections. The starts of logical page sections are signalled by input lines containing nothing but one of the following sequences of delimiter charac- ters: Line Start of ::: header :: body : footer If the input does not contain any logical page section signalling directives, the text being read is assumed to consist of a single logical page body. The following options are available: -b type Specify the logical page body lines to be numbered. Recognized type arguments are: a Number all lines. t Number only non-empty lines. n No line numbering. pexpr Number only those lines that contain the basic regular expression specified by expr. The default type for logical page body lines is t. -d delim Specify the delimiter characters used to indicate the start of a logical page section in the input file. At most two characters may be specified; if only one character is specified, the first character is replaced and the second character remains unchanged. The default delim characters are ``:''. -f type Specify the same as -b type except for logical page footer lines. The default type for logical page footer lines is n. -h type Specify the same as -b type except for logical page header lines. The default type for logical page header lines is n. -i incr Specify the increment value used to number logical page lines. The default incr value is 1. -l num If numbering of all lines is specified for the current logical section using the corresponding -b a, -f a or -h a option, spec- ify the number of adjacent blank lines to be considered as one. For example, -l 2 results in only the second adjacent blank line being numbered. The default num value is 1. -n format Specify the line numbering output format. Recognized format arguments are: ln Left justified. rn Right justified, leading zeros suppressed. rz Right justified, leading zeros kept. The default format is rn. -p Specify that line numbering should not be restarted at logical page delimiters. -s sep Specify the characters used in separating the line number and the corresponding text line. The default sep setting is a single tab character. -v startnum Specify the initial value used to number logical page lines; see also the description of the -p option. The default startnum value is 1. -w width Specify the number of characters to be occupied by the line number; in case the width is insufficient to hold the line number, it will be truncated to its width least significant digits. The default width is 6. ENVIRONMENT
The LANG, LC_ALL, LC_CTYPE and LC_COLLATE environment variables affect the execution of nl as described in environ(7). EXIT STATUS
The nl utility exits 0 on success, and >0 if an error occurs. SEE ALSO
jot(1), pr(1) STANDARDS
The nl utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The nl utility first appeared in AT&T System V Release 2 UNIX. BUGS
Input lines are limited to LINE_MAX (2048) bytes in length. BSD
January 26, 2005 BSD