9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man1 / nl.1
blob3a328fad477413e5af84c19659ca8c5a14031cc1
1 .\"
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/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
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.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
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.
30 .\"
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.
35 .\"
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]
41 .\"
42 .\"
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
46 .\"
47 .TH NL 1 "Mar 28, 1995"
48 .SH NAME
49 nl \- line numbering filter
50 .SH SYNOPSIS
51 .LP
52 .nf
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]
56 .fi
58 .LP
59 .nf
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]
63 .fi
65 .SH DESCRIPTION
66 .sp
67 .LP
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
71 in effect.
72 .sp
73 .LP
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.
80 .sp
81 .LP
82 The start of logical page sections are signaled by input lines containing
83 nothing but the following delimiter character(s):
84 .sp
86 .sp
87 .TS
88 box;
89 c | c
90 l | l .
91 Line contents   Start Of
93 \e:\e:\e:       header
95 \e:\e:  body
97 \e:     footer
98 .TE
102 Unless optioned otherwise, \fBnl\fR assumes the text being read is in a single
103 logical page body.
104 .SH OPTIONS
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:
115 .ne 2
117 \fB\fB-b\fR\fItype\fR\fR
119 .RS 14n
120 Specifies which logical page body lines are to be numbered. Recognized
121 \fItype\fRs and their meanings are:
123 .ne 2
125 \fB\fBa\fR\fR
127 .RS 8n
128 number all lines
132 .ne 2
134 \fB\fBt\fR\fR
136 .RS 8n
137 number all non-empty lines.
141 .ne 2
143 \fB\fBn\fR\fR
145 .RS 8n
146 no line numbering
150 .ne 2
152 \fB\fBp\fIexp\fR\fR\fR
154 .RS 8n
155 number only lines that contain the regular expression specified in \fIexp\fR.
156 See NOTES below.
159 Default \fItype\fR for logical page body is \fBt\fR (text lines numbered).
163 .ne 2
165 \fB\fB-f\fR\fItype\fR\fR
167 .RS 14n
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).
173 .ne 2
175 \fB\fB-d\fR\fIdelim\fR\fR
177 .RS 14n
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.
186 .ne 2
188 \fB\fB-h\fR\fItype\fR\fR
190 .RS 14n
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).
196 .ne 2
198 \fB\fB-i\fR\fIincr\fR\fR
200 .RS 14n
201 \fIincr\fR is the increment value used to number logical page lines. Default
202 \fIincr\fR is \fB1\fR.
206 .ne 2
208 \fB\fB-l\fR\fInum\fR\fR
210 .RS 14n
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.
218 .ne 2
220 \fB\fB-n\fR\fIformat\fR\fR
222 .RS 14n
223 \fIformat\fR is the line numbering format. Recognized values are:
225 .ne 2
227 \fB\fBln\fR\fR
229 .RS 6n
230 left justified, leading zeroes suppressed
234 .ne 2
236 \fB\fBrn\fR\fR
238 .RS 6n
239 right justified, leading zeroes suppressed
243 .ne 2
245 \fB\fBrz\fR\fR
247 .RS 6n
248 right justified, leading zeroes kept
251 Default \fIformat\fR is \fBrn\fR (right justified).
255 .ne 2
257 \fB\fB-p\fR\fR
259 .RS 14n
260 Do not restart numbering at logical page delimiters.
264 .ne 2
266 \fB\fB-s\fR\fIsep\fR\fR
268 .RS 14n
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.
274 .ne 2
276 \fB\fB-v\fR\fIstartnum\fR\fR
278 .RS 14n
279 \fIstartnum\fR is the initial value used to number logical page lines. Default
280 \fIstartnum\fR is \fB1\fR.
284 .ne 2
286 \fB\fB-w\fR\fIwidth\fR\fR
288 .RS 14n
289 \fIwidth\fR is the number of characters to be used for the line number. Default
290 \fIwidth\fR is \fB6\fR.
293 .SH OPERANDS
296 The following operand is supported:
298 .ne 2
300 \fB\fIfile\fR\fR
302 .RS 8n
303 A path name of a text file to be line-numbered.
306 .SH EXAMPLES
308 \fBExample 1 \fRAn example of the nl command
311 The command:
314 .in +2
316 example% \fBnl -v10 -i10 -d!+ filename1\fR
318 .in -2
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.
333 .SH EXIT STATUS
336 The following exit values are returned:
338 .ne 2
340 \fB\fB0\fR\fR
342 .RS 6n
343 Successful completion.
347 .ne 2
349 \fB\fB>0\fR\fR
351 .RS 6n
352 An error occurred.
355 .SH FILES
357 .ne 2
359 \fB\fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/CollTable\fR\fR
361 .sp .6
362 .RS 4n
363 Collation table generated by \fBlocaledef\fR
367 .ne 2
369 \fB\fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/coll.so\fR\fR
371 .sp .6
372 .RS 4n
373 Shared object containing string transformation library routines
376 .SH ATTRIBUTES
379 See \fBattributes\fR(5) for descriptions of the following attributes:
380 .SS "/usr/xpg4/bin/nl"
385 box;
386 c | c
387 l | l .
388 ATTRIBUTE TYPE  ATTRIBUTE VALUE
390 Interface Stability     Standard
393 .SH SEE ALSO
396 \fBpr\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBregex\fR(5),
397 \fBregexp\fR(5), \fBstandards\fR(5)
398 .SH NOTES
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:
404 .RS +4
406 .ie t \(bu
407 .el o
408 \fB/usr/lib/locale/\fIlocale\fR/LC_COLLATE/CollTable\fR is present.
410 .RS +4
412 .ie t \(bu
413 .el o
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).