⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nl.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>nl</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="nl"></a> <a name="tag_04_93"></a><!-- nl --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_93_01"></a>NAME</h4><blockquote>nl - line numbering filter</blockquote><h4><a name="tag_04_93_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> nl</tt> <b>[</b><tt>-p</tt><b>][</b><tt>-b</tt> <i>type</i><b>][</b><tt>-d</tt><i>delim</i><b>][</b><tt>-f</tt> <i>type</i><b>][</b><tt>-h</tt> <i>type</i><b>][</b><tt>-i</tt> <i>incr</i><b>][</b><tt>-l</tt><i>num</i><b>][</b><tt>-n</tt> <i>format</i><b>]<br></b> <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt> <b>[</b><tt>-s</tt> <i>sep</i><b>][</b><tt>-v</tt><i>startnum</i><b>][</b><tt>-w</tt> <i>width</i><b>][</b><i>file</i><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]"border="0"></tt></code></div></blockquote><h4><a name="tag_04_93_03"></a>DESCRIPTION</h4><blockquote><p>The <i>nl</i> utility shall read lines from the named <i>file</i> or the standard input if no <i>file</i> is named and shallreproduce the lines to standard output. Lines shall be numbered on the left. Additional functionality may be provided in accordancewith the command options in effect.</p><p>The <i>nl</i> utility views the text it reads in terms of logical pages. Line numbering shall be reset at the start of eachlogical page. A logical page consists of a header, a body, and a footer section. Empty sections are valid. Different line numberingoptions are independently available for header, body, and footer (for example, no numbering of header and footer lines whilenumbering blank lines only in the body).</p><p>The starts of logical page sections shall be signaled by input lines containing nothing but the following delimitercharacters:</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Line</b></p></th><th align="center"><p class="tent"><b>Start of</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">\:\:\:</p></td><td align="left"><p class="tent">Header</p></td></tr><tr valign="top"><td align="left"><p class="tent">\:\:</p></td><td align="left"><p class="tent">Body</p></td></tr><tr valign="top"><td align="left"><p class="tent">\:</p></td><td align="left"><p class="tent">Footer</p></td></tr></table></center><p>Unless otherwise specified, <i>nl</i> shall assume the text being read is in a single logical page body.</p></blockquote><h4><a name="tag_04_93_04"></a>OPTIONS</h4><blockquote><p>The <i>nl</i> utility shall conform to the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>. Only one file can be named.</p><p>The following options shall be supported:</p><dl compact><dt><b>-b&nbsp;</b> <i>type</i></dt><dd>Specify which logical page body lines shall be numbered. Recognized <i>types</i> and their meaning are: <dl compact><dt><b>a</b></dt><dd>Number all lines.</dd><dt><b>t</b></dt><dd>Number only non-empty lines.</dd><dt><b>n</b></dt><dd>No line numbering.</dd><dt><b>p</b><i>string</i></dt><dd>Number only lines that contain the basic regular expression specified in <i>string</i>.</dd></dl><p>The default <i>type</i> for logical page body shall be <b>t</b> (text lines numbered).</p></dd><dt><b>-d&nbsp;</b> <i>delim</i></dt><dd>Specify the delimiter characters that indicate the start of a logical page section. These can be changed from the defaultcharacters <tt>"\:"</tt> to two user-specified characters. If only one character is entered, the second character shall remain thedefault character <tt>':'</tt> .</dd><dt><b>-f&nbsp;</b> <i>type</i></dt><dd>Specify the same as <b>b</b> <i>type</i> except for footer. The default for logical page footer shall be <b>n</b> (no linesnumbered).</dd><dt><b>-h&nbsp;</b> <i>type</i></dt><dd>Specify the same as <b>b</b> <i>type</i> except for header. The default <i>type</i> for logical page header shall be <b>n</b>(no lines numbered).</dd><dt><b>-i&nbsp;</b> <i>incr</i></dt><dd>Specify the increment value used to number logical page lines. The default shall be 1.</dd><dt><b>-l&nbsp;</b> <i>num</i></dt><dd>Specify the number of blank lines to be considered as one. For example, <b>-l&nbsp;2</b> results in only the second adjacentblank line being numbered (if the appropriate <b>-h&nbsp;a</b>, <b>-b&nbsp;a</b>, or <b>-f&nbsp;a</b> option is set). The defaultshall be 1.</dd><dt><b>-n&nbsp;</b> <i>format</i></dt><dd>Specify the line numbering format. Recognized values are: <b>ln</b>, left justified, leading zeros suppressed; <b>rn</b>, rightjustified, leading zeros suppressed; <b>rz</b>, right justified, leading zeros kept. The default <i>format</i> shall be <b>rn</b>(right justified).</dd><dt><b>-p</b></dt><dd>Specify that numbering should not be restarted at logical page delimiters.</dd><dt><b>-s&nbsp;</b> <i>sep</i></dt><dd>Specify the characters used in separating the line number and the corresponding text line. The default <i>sep</i> shall be a&lt;tab&gt;.</dd><dt><b>-v&nbsp;</b> <i>startnum</i></dt><dd>Specify the initial value used to number logical page lines. The default shall be 1.</dd><dt><b>-w&nbsp;</b> <i>width</i></dt><dd>Specify the number of characters to be used for the line number. The default <i>width</i> shall be 6.</dd></dl></blockquote><h4><a name="tag_04_93_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>file</i></dt><dd>A pathname of a text file to be line-numbered.</dd></dl></blockquote><h4><a name="tag_04_93_06"></a>STDIN</h4><blockquote><p>The standard input is a text file that is used if no <i>file</i> operand is given.</p></blockquote><h4><a name="tag_04_93_07"></a>INPUT FILES</h4><blockquote><p>The input file named by the <i>file</i> operand is a text file.</p></blockquote><h4><a name="tag_04_93_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>nl</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_COLLATE</i></dt><dd><br>Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regularexpressions.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files), the behavior of character classes within regular expressions, andfor deciding which characters are in character class <b>graph</b> (for the <b>-b&nbsp;t</b>, <b>-f&nbsp;t</b>, and <b>-h&nbsp;t</b>options).</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>NLSPATH</i></dt><dd>Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i></dd></dl></blockquote><h4><a name="tag_04_93_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_93_10"></a>STDOUT</h4><blockquote><p>The standard output shall be a text file in the following format:</p><pre><tt>"%s%s%s", &lt;</tt><i>line number</i><tt>&gt;, &lt;</tt><i>separator</i><tt>&gt;, &lt;</tt><i>input line</i><tt>&gt;</tt></pre><p>where &lt;<i>line&nbsp;number</i>&gt; is one of the following numeric formats:</p><dl compact><dt><tt>%6d</tt></dt><dd>When the <b>rn</b> format is used (the default; see <b>-n</b>).</dd><dt><tt>%06d</tt></dt><dd>When the <b>rz</b> format is used.</dd><dt><tt>%-6d</tt></dt><dd>When the <b>ln</b> format is used.</dd><dt>&lt;empty&gt;</dt><dd>When line numbers are suppressed for a portion of the page; the &lt;<i>separator</i>&gt; is also suppressed.</dd></dl><p>In the preceding list, the number 6 is the default width; the <b>-w</b> option can change this value.</p></blockquote><h4><a name="tag_04_93_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_93_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_93_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_93_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt>&nbsp;0</dt><dd>Successful completion.</dd><dt>&gt;0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_93_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_93_16"></a>APPLICATION USAGE</h4><blockquote><p>In using the <b>-d</b> <i>delim</i> option, care should be taken to escape characters that have special meaning to the commandinterpreter.</p></blockquote><h4><a name="tag_04_93_17"></a>EXAMPLES</h4><blockquote><p>The command:</p><pre><tt>nl -v 10 -i 10 -d \!+ file1</tt></pre><p>numbers <i>file1</i> starting at line number 10 with an increment of 10. The logical page delimiter is <tt>"!+"</tt> . Note thatthe <tt>'!'</tt> has to be escaped when using <i>csh</i> as a command interpreter because of its history substitution syntax. For<i>ksh</i> and <a href="../utilities/sh.html"><i>sh</i></a> the escape is not necessary, but does not do any harm.</p></blockquote><h4><a name="tag_04_93_18"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_93_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_93_20"></a>SEE ALSO</h4><blockquote><p><a href="pr.html"><i>pr</i></a></p></blockquote><h4><a name="tag_04_93_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 2.</p></blockquote><h4><a name="tag_04_93_22"></a>Issue 5</h4><blockquote><p>The option [ <b>-f</b> <i>type</i>] is added to the SYNOPSIS. The option descriptions are presented in alphabetic order. Thedescription of <b>-bt</b> is changed to &quot;Number only non-empty lines&quot;.</p></blockquote><h4><a name="tag_04_93_23"></a>Issue 6</h4><blockquote><p>The obsolescent behavior allowing the options to be intermingled with the optional <i>file</i> operand is removed.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -