*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: nl | Section: 1 | Source: Digital UNIX | File: nl.1.gz
nl(1) General Commands Manual nl(1) NAME nl - Numbers lines in a file SYNOPSIS nl [-b type] [-d delimiter1[delimiter2]] [-f type] [-h type] [-i num- ber] [-l number] [-n format] [-p] [-s [separator]] [-vnumber] [-wnum- ber] [file] STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: nl: XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. OPTIONS Use the following options to change the default settings. Specifies which body section lines to number. The recognized types are as fol- lows: Numbers all lines. Number only lines with text consisting of at least one character in the current locale's graph character classifica- tion. Does not number any lines. Numbers only those lines containing the specified pattern. The full range of regular expressions is sup- ported for pattern. The default for type is t. Uses delimiter1 and delimiter2 as the delimiters for the start of a logical page section. The de- fault characters are \: (backslash followed by a colon). You can specify either one or two characters after the -d op- tion. If you want to use a backslash as a delimiter, enter two backslashes (\\). If you specify only one character, it is used as start of a logical page, and the end delimiter remains the default. Specifies which logical page footer lines to number. The types recognized are the same as in -b type. The default for type is n. Specifies which logical page header lines to number. The types recognized are the same as in -b type. The default for type is n. Increments logical page line numbers by number. The default is 1. Counts number blank lines as 1. You must use one or more of the "-ba", "-fa", and "-ha" options with this option for it to be effective. For example, -l3 will only number the third adjacent blank. The default is 1. Speci- fies format as the line numbering format. Recognized formats are as follows: Left justified, leading zeroes are suppressed. Right justified, leading zeroes are suppressed (default). Right justified, leading zeroes are kept. Ignores logical page delim- iters (does not restart numbering). Separates text from line numbers with the separator string. The default value of separa- tor is a tab character. [DIGITAL] If you enter -s without an argument, there is no sep- aration between the line number and its text. Sets the initial logical page line number to number. Specifies number as the number of digits in the line number. The default value of num- ber is 6. OPERANDS The path name of a file in which the lines are to be numbered. If file is not specified, standard input is used. DESCRIPTION The nl command reads file (standard input by default), numbers the lines in the input, and writes the numbered lines to standard output. In the output, nl numbers the lines on the left, according to the op- tions 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 option, nl resets the line numbers at the start of each logical page. You can set line numbering options 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 con- tain nothing but the following delimiter characters (assuming the de- fault delimiters--see the description of the -d option): l l. Line Contents Start of \:\:\: Header \:\: Body \: Footer You can name only one file on the command line. You can list the op- tions and the file name in any order. EXIT STATUS The following exit values are returned: Successful completion. An er- ror occurred. EXAMPLES To number only the nonblank lines, enter: nl chap1 This displays a numbered listing of chap1, numbering only the nonblank lines in the body sections. If chap1 contains no \:\:\ :, \:\ :, or \: delimiters, then the entire file is considered the body. To number all lines, enter: nl -ba chap1 This numbers all the lines in the body sections, including blank lines. This form of the nl command is adequate for most uses. To specify a different line number format, enter: nl -i10 -nrz -s:: -v10 -w4 chap1 This numbers the lines of chap1, starting with 10 (-v10) and counting by 10s (-i10). It displays four digits for each number (-w4), including leading zeroes (-nrz). The line numbers are separated from the text by two colons (-s::). For example, if chap1 contains the following text: A not-so-important note to remember: You can't kill time without injuring eternity. then the numbered listing is as follows: 0010::A not-so-important note to remember: 0020::You can't kill time without injuring eternity. Notice that the blank line was not numbered. To do this, use the -ba option as shown in Example 2. ENVIRONMENT VARIABLES The following environment variables affect the execution of nl: Pro- vides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, over- rides the values of all the other internationalization variables. De- termines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi- byte characters in arguments and input files), the behavior of classes within regular expressions, and for deciding which characters are in character class graph. Determines the locale for the format and con- tents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO Commands: cat(1), pr(1) Standards: standards(5) nl(1)

Navigation Options