isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

nl.html (15165B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>nl</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/nice.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/nm.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
     19 </tr>
     20 </table>
     21 <hr align="left" width="100%"></div>
     22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     23 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     24 IEEE Std 1003.1-2024<br>
     25 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     26 <hr size="2" noshade>
     27 <a name="top" id="top"></a> <a name="nl" id="nl"></a> <a name="tag_20_87" id="tag_20_87"></a><!-- nl -->
     28 <h4 class="mansect"><a name="tag_20_87_01" id="tag_20_87_01"></a>NAME</h4>
     29 <blockquote>nl — line numbering filter</blockquote>
     30 <h4 class="mansect"><a name="tag_20_87_02" id="tag_20_87_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
     33 "[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>]
     34 [</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>
     35 <i>num</i><b>]<br></b> <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt> <b>[</b><tt>-n</tt> <i>format</i><b>] [</b><tt>-s</tt>
     36 <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=
     37 "../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
     38 </blockquote>
     39 <h4 class="mansect"><a name="tag_20_87_03" id="tag_20_87_03"></a>DESCRIPTION</h4>
     40 <blockquote>
     41 <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 shall
     42 reproduce the lines to standard output. Lines shall be numbered on the left. Additional functionality may be provided in accordance
     43 with the command options in effect.</p>
     44 <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 each
     45 logical page. A logical page consists of a header, a body, and a footer section. Empty sections are valid. Different line numbering
     46 options are independently available for header, body, and footer (for example, no numbering of header and footer lines while
     47 numbering blank lines only in the body).</p>
     48 <p>The starts of logical page sections shall be signaled by input lines containing nothing but the following delimiter
     49 characters:</p>
     50 <center>
     51 <table border="1" cellpadding="3" align="center">
     52 <tr valign="top">
     53 <th align="center">
     54 <p class="tent"><b>Line</b></p>
     55 </th>
     56 <th align="center">
     57 <p class="tent"><b>Start of</b></p>
     58 </th>
     59 </tr>
     60 <tr valign="top">
     61 <td align="left">
     62 <p class="tent">\:\:\:</p>
     63 </td>
     64 <td align="left">
     65 <p class="tent">Header</p>
     66 </td>
     67 </tr>
     68 <tr valign="top">
     69 <td align="left">
     70 <p class="tent">\:\:</p>
     71 </td>
     72 <td align="left">
     73 <p class="tent">Body</p>
     74 </td>
     75 </tr>
     76 <tr valign="top">
     77 <td align="left">
     78 <p class="tent">\:</p>
     79 </td>
     80 <td align="left">
     81 <p class="tent">Footer</p>
     82 </td>
     83 </tr>
     84 </table>
     85 </center>
     86 <p class="tent">Unless otherwise specified, <i>nl</i> shall assume the text being read is in a single logical page body.</p>
     87 </blockquote>
     88 <h4 class="mansect"><a name="tag_20_87_04" id="tag_20_87_04"></a>OPTIONS</h4>
     89 <blockquote>
     90 <p>The <i>nl</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     91 Guidelines</i></a> . Only one file can be named.</p>
     92 <p class="tent">The following options shall be supported:</p>
     93 <dl compact>
     94 <dd></dd>
     95 <dt><b>-b&nbsp;</b><i>type</i></dt>
     96 <dd>Specify which logical page body lines shall be numbered. Recognized <i>types</i> and their meaning are:
     97 <dl compact>
     98 <dd></dd>
     99 <dt><b>a</b></dt>
    100 <dd>Number all lines.</dd>
    101 <dt><b>t</b></dt>
    102 <dd>Number only non-empty lines.</dd>
    103 <dt><b>n</b></dt>
    104 <dd>No line numbering.</dd>
    105 <dt><b>p</b><i>string</i></dt>
    106 <dd>Number only lines that contain the basic regular expression specified in <i>string</i>.</dd>
    107 </dl>
    108 <p class="tent">The default <i>type</i> for logical page body shall be <b>t</b> (text lines numbered).</p>
    109 </dd>
    110 <dt><b>-d&nbsp;</b><i>delim</i></dt>
    111 <dd>Specify the delimiter characters that indicate the start of a logical page section. These can be changed from the default
    112 characters <tt>"\:"</tt> to two user-specified characters. If only one character is entered, the second character shall remain the
    113 default character <tt>':'</tt>.</dd>
    114 <dt><b>-f&nbsp;</b><i>type</i></dt>
    115 <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 lines
    116 numbered).</dd>
    117 <dt><b>-h&nbsp;</b><i>type</i></dt>
    118 <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>
    119 (no lines numbered).</dd>
    120 <dt><b>-i&nbsp;</b><i>incr</i></dt>
    121 <dd>Specify the increment value used to number logical page lines. The default shall be 1.</dd>
    122 <dt><b>-l&nbsp;</b><i>num</i></dt>
    123 <dd>Specify the number of blank lines to be considered as one. For example, <b>-l&nbsp;2</b> results in only the second adjacent
    124 blank 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 default
    125 shall be 1.</dd>
    126 <dt><b>-n&nbsp;</b><i>format</i></dt>
    127 <dd>Specify the line numbering format. Recognized values are: <b>ln</b>, left justified, leading zeros suppressed; <b>rn</b>, right
    128 justified, leading zeros suppressed; <b>rz</b>, right justified, leading zeros kept. The default <i>format</i> shall be <b>rn</b>
    129 (right justified).</dd>
    130 <dt><b>-p</b></dt>
    131 <dd>Specify that numbering should not be restarted at logical page delimiters.</dd>
    132 <dt><b>-s&nbsp;</b><i>sep</i></dt>
    133 <dd>Specify the characters used in separating the line number and the corresponding text line. The default <i>sep</i> shall be a
    134 &lt;tab&gt;.</dd>
    135 <dt><b>-v&nbsp;</b><i>startnum</i></dt>
    136 <dd>Specify the initial value used to number logical page lines. The default shall be 1.</dd>
    137 <dt><b>-w&nbsp;</b><i>width</i></dt>
    138 <dd>Specify the number of characters to be used for the line number. The default <i>width</i> shall be 6.</dd>
    139 </dl>
    140 </blockquote>
    141 <h4 class="mansect"><a name="tag_20_87_05" id="tag_20_87_05"></a>OPERANDS</h4>
    142 <blockquote>
    143 <p>The following operand shall be supported:</p>
    144 <dl compact>
    145 <dd></dd>
    146 <dt><i>file</i></dt>
    147 <dd>A pathname of a text file to be line-numbered.</dd>
    148 </dl>
    149 </blockquote>
    150 <h4 class="mansect"><a name="tag_20_87_06" id="tag_20_87_06"></a>STDIN</h4>
    151 <blockquote>
    152 <p>The standard input shall be used if no <i>file</i> operand is specified, and shall be used if the <i>file</i> operand is
    153 <tt>'-'</tt> and the implementation treats the <tt>'-'</tt> as meaning standard input. Otherwise, the standard input shall not be
    154 used. See the INPUT FILES section.</p>
    155 </blockquote>
    156 <h4 class="mansect"><a name="tag_20_87_07" id="tag_20_87_07"></a>INPUT FILES</h4>
    157 <blockquote>
    158 <p>The input file shall be a text file.</p>
    159 </blockquote>
    160 <h4 class="mansect"><a name="tag_20_87_08" id="tag_20_87_08"></a>ENVIRONMENT VARIABLES</h4>
    161 <blockquote>
    162 <p>The following environment variables shall affect the execution of <i>nl</i>:</p>
    163 <dl compact>
    164 <dd></dd>
    165 <dt><i>LANG</i></dt>
    166 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    167 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    168 variables used to determine the values of locale categories.)</dd>
    169 <dt><i>LC_ALL</i></dt>
    170 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    171 <dt><i>LC_COLLATE</i></dt>
    172 <dd><br>
    173 Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regular
    174 expressions.</dd>
    175 <dt><i>LC_CTYPE</i></dt>
    176 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    177 opposed to multi-byte characters in arguments and input files), the behavior of character classes within regular expressions, and
    178 for 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>
    179 options).</dd>
    180 <dt><i>LC_MESSAGES</i></dt>
    181 <dd><br>
    182 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    183 <dt><i>NLSPATH</i></dt>
    184 <dd>Determine the location of messages objects and message catalogs.</dd>
    185 </dl>
    186 </blockquote>
    187 <h4 class="mansect"><a name="tag_20_87_09" id="tag_20_87_09"></a>ASYNCHRONOUS EVENTS</h4>
    188 <blockquote>
    189 <p>Default.</p>
    190 </blockquote>
    191 <h4 class="mansect"><a name="tag_20_87_10" id="tag_20_87_10"></a>STDOUT</h4>
    192 <blockquote>
    193 <p>The standard output shall be a text file in the following format:</p>
    194 <pre>
    195 <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;
    196 </tt></pre>
    197 <p class="tent">where &lt;<i>line&nbsp;number</i>&gt; is one of the following numeric formats:</p>
    198 <dl compact>
    199 <dd></dd>
    200 <dt><tt>%6d</tt></dt>
    201 <dd>When the <b>rn</b> format is used (the default; see <b>-n</b>).</dd>
    202 <dt><tt>%06d</tt></dt>
    203 <dd>When the <b>rz</b> format is used.</dd>
    204 <dt><tt>%-6d</tt></dt>
    205 <dd>When the <b>ln</b> format is used.</dd>
    206 <dt>&lt;empty&gt;</dt>
    207 <dd>When line numbers are suppressed for a portion of the page; the &lt;<i>separator</i>&gt; is also suppressed.</dd>
    208 </dl>
    209 <p class="tent">In the preceding list, the number 6 is the default width; the <b>-w</b> option can change this value.</p>
    210 </blockquote>
    211 <h4 class="mansect"><a name="tag_20_87_11" id="tag_20_87_11"></a>STDERR</h4>
    212 <blockquote>
    213 <p>The standard error shall be used only for diagnostic messages.</p>
    214 </blockquote>
    215 <h4 class="mansect"><a name="tag_20_87_12" id="tag_20_87_12"></a>OUTPUT FILES</h4>
    216 <blockquote>
    217 <p>None.</p>
    218 </blockquote>
    219 <h4 class="mansect"><a name="tag_20_87_13" id="tag_20_87_13"></a>EXTENDED DESCRIPTION</h4>
    220 <blockquote>
    221 <p>None.</p>
    222 </blockquote>
    223 <h4 class="mansect"><a name="tag_20_87_14" id="tag_20_87_14"></a>EXIT STATUS</h4>
    224 <blockquote>
    225 <p>The following exit values shall be returned:</p>
    226 <dl compact>
    227 <dd></dd>
    228 <dt>&nbsp;0</dt>
    229 <dd>Successful completion.</dd>
    230 <dt>&gt;0</dt>
    231 <dd>An error occurred.</dd>
    232 </dl>
    233 </blockquote>
    234 <h4 class="mansect"><a name="tag_20_87_15" id="tag_20_87_15"></a>CONSEQUENCES OF ERRORS</h4>
    235 <blockquote>
    236 <p>Default.</p>
    237 </blockquote>
    238 <hr>
    239 <div class="box"><em>The following sections are informative.</em></div>
    240 <h4 class="mansect"><a name="tag_20_87_16" id="tag_20_87_16"></a>APPLICATION USAGE</h4>
    241 <blockquote>
    242 <p>In using the <b>-d</b> <i>delim</i> option, care should be taken to escape characters that have special meaning to the command
    243 interpreter.</p>
    244 </blockquote>
    245 <h4 class="mansect"><a name="tag_20_87_17" id="tag_20_87_17"></a>EXAMPLES</h4>
    246 <blockquote>
    247 <p>The command:</p>
    248 <pre>
    249 <tt>nl -v 10 -i 10 -d \!+ file1
    250 </tt></pre>
    251 <p class="tent">numbers <i>file1</i> starting at line number 10 with an increment of 10. The logical page delimiter is
    252 <tt>"!+"</tt>. Note that the <tt>'!'</tt> has to be escaped when using <i>csh</i> as a command interpreter because of its history
    253 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
    254 any harm.</p>
    255 </blockquote>
    256 <h4 class="mansect"><a name="tag_20_87_18" id="tag_20_87_18"></a>RATIONALE</h4>
    257 <blockquote>
    258 <p>None.</p>
    259 </blockquote>
    260 <h4 class="mansect"><a name="tag_20_87_19" id="tag_20_87_19"></a>FUTURE DIRECTIONS</h4>
    261 <blockquote>
    262 <p>None.</p>
    263 </blockquote>
    264 <h4 class="mansect"><a name="tag_20_87_20" id="tag_20_87_20"></a>SEE ALSO</h4>
    265 <blockquote>
    266 <p><a href="../utilities/pr.html#"><i>pr</i></a></p>
    267 <p class="tent">XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    268 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    269 </blockquote>
    270 <h4 class="mansect"><a name="tag_20_87_21" id="tag_20_87_21"></a>CHANGE HISTORY</h4>
    271 <blockquote>
    272 <p>First released in Issue 2.</p>
    273 </blockquote>
    274 <h4 class="mansect"><a name="tag_20_87_22" id="tag_20_87_22"></a>Issue 5</h4>
    275 <blockquote>
    276 <p>The option [<b>-f</b> <i>type</i>] is added to the SYNOPSIS. The option descriptions are presented in alphabetic order. The
    277 description of <b>-bt</b> is changed to &quot;Number only non-empty lines&quot;.</p>
    278 </blockquote>
    279 <h4 class="mansect"><a name="tag_20_87_23" id="tag_20_87_23"></a>Issue 6</h4>
    280 <blockquote>
    281 <p>The obsolescent behavior allowing the options to be intermingled with the optional <i>file</i> operand is removed.</p>
    282 </blockquote>
    283 <h4 class="mansect"><a name="tag_20_87_24" id="tag_20_87_24"></a>Issue 7</h4>
    284 <blockquote>
    285 <p>Austin Group Interpretation 1003.1-2001 #092 is applied.</p>
    286 <p class="tent">SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    287 </blockquote>
    288 <h4 class="mansect"><a name="tag_20_87_25" id="tag_20_87_25"></a>Issue 8</h4>
    289 <blockquote>
    290 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    291 </blockquote>
    292 <div class="box"><em>End of informative text.</em></div>
    293 <hr>
    294 <p>&nbsp;</p>
    295 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    296 <hr size="2" noshade>
    297 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    298 POSIX™ is a Trademark of The IEEE.<br>
    299 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    300 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    301 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    302 ]</font></center>
    303 <hr size="2" noshade>
    304 <div class="NAVHEADER">
    305 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    306 <tr class="nav">
    307 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/nice.html" accesskey="P">&lt;&lt;&lt;
    308 Previous</a></td>
    309 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    310 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/nm.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    311 </tr>
    312 </table>
    313 <hr align="left" width="100%"></div>
    314 </body>
    315 </html>