2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved.
45 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
47 .TH NL 1 "Mar 28, 1995"
49 nl \- line numbering filter
53 \fB/usr/bin/nl\fR [\fB-p\fR] [\fB-b\fR [\fItype\fR]] [\fB-d\fR [\fIdelim\fR]] [\fB-f\fR [\fItype\fR]]
54 [\fB-h\fR [\fItype\fR]] [\fB-i\fR [\fIincr\fR]] [\fB-l\fR [\fInum\fR]] [\fB-n\fR [\fIformat\fR]]
55 [\fB-s\fR [\fIsep\fR]] [\fB-w\fR [\fIwidth\fR]] [\fB-v\fR [\fIstartnum\fR]] [\fIfile\fR]
60 \fB/usr/xpg4/bin/nl\fR [\fB-p\fR] [\fB-b\fR \fItype\fR] [\fB-d\fR \fIdelim\fR] [\fB-f\fR \fItype\fR]
61 [\fB-h\fR \fItype\fR] [\fB-i\fR \fIincr\fR] [\fB-l\fR \fInum\fR] [\fB-n\fR \fIformat\fR] [\fB-s\fR \fIsep\fR]
62 [\fB-w\fR \fIwidth\fR] [\fB-v\fR \fIstartnum\fR] [\fIfile\fR]
68 The \fBnl\fR utility reads lines from the named \fIfile\fR, or the standard
69 input if no \fIfile\fR is named, and reproduces the lines on the standard
70 output. Lines are numbered on the left in accordance with the command options
74 \fBnl\fR views the text it reads in terms of logical pages. Line numbering is
75 reset at the start of each logical page. A logical page consists of a header, a
76 body, and a footer section. Empty sections are valid. Different line numbering
77 options are independently available for header, body, and footer. For example,
78 \fB-bt\fR (the default) numbers non-blank lines in the body section and does
79 not number any lines in the header and footer sections.
82 The start of logical page sections are signaled by input lines containing
83 nothing but the following delimiter character(s):
91 Line contents Start Of
102 Unless optioned otherwise, \fBnl\fR assumes the text being read is in a single
107 Command options may appear in any order and may be intermingled with an
108 optional file name. Only one file may be named. The specified default is used
109 when the option is not entered on the command line. \fB/usr/xpg4/bin/nl\fR
110 options require option arguments. A \fBSPACE\fR character \fBmay\fR separate
111 options from option arguments. \fB/usr/bin/nl\fR options \fBmay\fR have option
112 arguments. If option-arguments of \fB/usr/bin/nl\fR options are not specified,
113 these options result in the default. The supported options are:
117 \fB\fB-b\fR\fItype\fR\fR
120 Specifies which logical page body lines are to be numbered. Recognized
121 \fItype\fRs and their meanings are:
137 number all non-empty lines.
152 \fB\fBp\fIexp\fR\fR\fR
155 number only lines that contain the regular expression specified in \fIexp\fR.
159 Default \fItype\fR for logical page body is \fBt\fR (text lines numbered).
165 \fB\fB-f\fR\fItype\fR\fR
168 Same as \fB-b\fR\fItype\fR except for footer. Default \fItype\fR for logical
169 page footer is \fBn\fR (no lines numbered).
175 \fB\fB-d\fR\fIdelim\fR\fR
178 The two delimiter characters specifying the start of a logical page section may
179 be changed from the default characters (\e\|:\|) to two user-specified
180 characters. If only one character is entered, the second character remains the
181 default character (:). No space should appear between the \fB-d\fR and the
182 delimiter characters. To enter a backslash, use two backslashes.
188 \fB\fB-h\fR\fItype\fR\fR
191 Same as \fB-b\fR\fItype\fR except for header. Default \fItype\fR for logical
192 page header is \fBn\fR (no lines numbered).
198 \fB\fB-i\fR\fIincr\fR\fR
201 \fIincr\fR is the increment value used to number logical page lines. Default
202 \fIincr\fR is \fB1\fR.
208 \fB\fB-l\fR\fInum\fR\fR
211 \fInum\fR is the number of blank lines to be considered as one. For example,
212 \fB\(mil2\fR results in only the second adjacent blank being numbered (if the
213 appropriate \fB-ha\fR, \fB-ba\fR, and/or \fB-fa\fR option is set). Default
214 \fInum\fR is \fB1\fR.
220 \fB\fB-n\fR\fIformat\fR\fR
223 \fIformat\fR is the line numbering format. Recognized values are:
230 left justified, leading zeroes suppressed
239 right justified, leading zeroes suppressed
248 right justified, leading zeroes kept
251 Default \fIformat\fR is \fBrn\fR (right justified).
260 Do not restart numbering at logical page delimiters.
266 \fB\fB-s\fR\fIsep\fR\fR
269 \fIsep\fR is the character(s) used in separating the line number and the
270 corresponding text line. Default \fIsep\fR is a \fBTAB\fR.
276 \fB\fB-v\fR\fIstartnum\fR\fR
279 \fIstartnum\fR is the initial value used to number logical page lines. Default
280 \fIstartnum\fR is \fB1\fR.
286 \fB\fB-w\fR\fIwidth\fR\fR
289 \fIwidth\fR is the number of characters to be used for the line number. Default
290 \fIwidth\fR is \fB6\fR.
296 The following operand is supported:
303 A path name of a text file to be line-numbered.
308 \fBExample 1 \fRAn example of the nl command
316 example% \fBnl -v10 -i10 -d!+ filename1\fR
323 will cause the first line of the page body to be numbered \fB10\fR, the second
324 line of the page body to be numbered \fB20\fR, the third \fB30\fR, and so
325 forth. The logical page delimiters are !+.
327 .SH ENVIRONMENT VARIABLES
330 See \fBenviron\fR(5) for descriptions of the following environment variables
331 that affect the execution of \fBnl\fR: \fBLANG\fR, \fBLC_ALL\fR,
332 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
336 The following exit values are returned:
343 Successful completion.
359 \fB\fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/CollTable\fR\fR
363 Collation table generated by \fBlocaledef\fR
369 \fB\fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/coll.so\fR\fR
373 Shared object containing string transformation library routines
379 See \fBattributes\fR(5) for descriptions of the following attributes:
380 .SS "/usr/xpg4/bin/nl"
388 ATTRIBUTE TYPE ATTRIBUTE VALUE
390 Interface Stability Standard
396 \fBpr\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBregex\fR(5),
397 \fBregexp\fR(5), \fBstandards\fR(5)
401 Internationalized Regular Expressions are used in the POSIX and "C" locales. In
402 other locales, Internationalized Regular Expressions are used if the following
403 two conditions are met:
408 \fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/CollTable\fR is present.
414 \fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/coll.so\fR is not present.
418 Otherwise, Simple Regular Expressions are used.
421 Internationalized Regular Expressions are explained on \fBregex\fR(5). Simple
422 Regular Expressions are explained on \fBregexp\fR(5).