isposix

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

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

tr.html (26904B)


      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>tr</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/tput.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/true.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="tr" id="tr"></a> <a name="tag_20_126" id="tag_20_126"></a><!-- tr -->
     28 <h4 class="mansect"><a name="tag_20_126_01" id="tag_20_126_01"></a>NAME</h4>
     29 <blockquote>tr — translate characters</blockquote>
     30 <h4 class="mansect"><a name="tag_20_126_02" id="tag_20_126_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt>tr</tt> <b>[</b><tt>-c|-C</tt><b>] [</b><tt>-s</tt><b>]</b> <i>string1 string2</i> <tt><br>
     33 <br>
     34 tr -s</tt> <b>[</b><tt>-c|-C</tt><b>]</b> <i>string1</i> <tt><br>
     35 <br>
     36 tr -d</tt> <b>[</b><tt>-c|-C</tt><b>]</b> <i>string1</i> <tt><br>
     37 <br>
     38 tr -ds</tt> <b>[</b><tt>-c|-C</tt><b>]</b> <i>string1 string2</i> <tt><br></tt></code></p>
     39 </blockquote>
     40 <h4 class="mansect"><a name="tag_20_126_03" id="tag_20_126_03"></a>DESCRIPTION</h4>
     41 <blockquote>
     42 <p>The <i>tr</i> utility shall copy the standard input to the standard output with substitution or deletion of selected characters.
     43 The options specified and the <i>string1</i> and <i>string2</i> operands shall control translations that occur while copying
     44 characters and single-character collating elements.</p>
     45 </blockquote>
     46 <h4 class="mansect"><a name="tag_20_126_04" id="tag_20_126_04"></a>OPTIONS</h4>
     47 <blockquote>
     48 <p>The <i>tr</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     49 Guidelines</i></a> .</p>
     50 <p>The following options shall be supported:</p>
     51 <dl compact>
     52 <dd></dd>
     53 <dt><b>-c</b></dt>
     54 <dd>Complement the set of values specified by <i>string1</i>. See the EXTENDED DESCRIPTION section.</dd>
     55 <dt><b>-C</b></dt>
     56 <dd>Complement the set of characters specified by <i>string1</i>. See the EXTENDED DESCRIPTION section.</dd>
     57 <dt><b>-d</b></dt>
     58 <dd>Delete all occurrences of input characters that are specified by <i>string1</i>.</dd>
     59 <dt><b>-s</b></dt>
     60 <dd>Replace instances of repeated characters with a single character, as described in the EXTENDED DESCRIPTION section.</dd>
     61 </dl>
     62 </blockquote>
     63 <h4 class="mansect"><a name="tag_20_126_05" id="tag_20_126_05"></a>OPERANDS</h4>
     64 <blockquote>
     65 <p>The following operands shall be supported:</p>
     66 <dl compact>
     67 <dd></dd>
     68 <dt><i>string1</i>,&nbsp;<i>string2</i></dt>
     69 <dd><br>
     70 Translation control strings. Each string shall represent a set of characters to be converted into an array of characters used for
     71 the translation. For a detailed description of how the strings are interpreted, see the EXTENDED DESCRIPTION section.</dd>
     72 </dl>
     73 </blockquote>
     74 <h4 class="mansect"><a name="tag_20_126_06" id="tag_20_126_06"></a>STDIN</h4>
     75 <blockquote>
     76 <p>The standard input can be any type of file.</p>
     77 </blockquote>
     78 <h4 class="mansect"><a name="tag_20_126_07" id="tag_20_126_07"></a>INPUT FILES</h4>
     79 <blockquote>
     80 <p>None.</p>
     81 </blockquote>
     82 <h4 class="mansect"><a name="tag_20_126_08" id="tag_20_126_08"></a>ENVIRONMENT VARIABLES</h4>
     83 <blockquote>
     84 <p>The following environment variables shall affect the execution of <i>tr</i>:</p>
     85 <dl compact>
     86 <dd></dd>
     87 <dt><i>LANG</i></dt>
     88 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
     89 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
     90 variables used to determine the values of locale categories.)</dd>
     91 <dt><i>LC_ALL</i></dt>
     92 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
     93 <dt><i>LC_COLLATE</i></dt>
     94 <dd><br>
     95 Determine the locale for the behavior of range expressions and equivalence classes.</dd>
     96 <dt><i>LC_CTYPE</i></dt>
     97 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
     98 opposed to multi-byte characters in arguments) and the behavior of character classes.</dd>
     99 <dt><i>LC_MESSAGES</i></dt>
    100 <dd><br>
    101 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    102 <dt><i>NLSPATH</i></dt>
    103 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    104 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    105 "0"></dd>
    106 </dl>
    107 </blockquote>
    108 <h4 class="mansect"><a name="tag_20_126_09" id="tag_20_126_09"></a>ASYNCHRONOUS EVENTS</h4>
    109 <blockquote>
    110 <p>Default.</p>
    111 </blockquote>
    112 <h4 class="mansect"><a name="tag_20_126_10" id="tag_20_126_10"></a>STDOUT</h4>
    113 <blockquote>
    114 <p>The <i>tr</i> output shall be identical to the input, with the exception of the specified transformations.</p>
    115 </blockquote>
    116 <h4 class="mansect"><a name="tag_20_126_11" id="tag_20_126_11"></a>STDERR</h4>
    117 <blockquote>
    118 <p>The standard error shall be used only for diagnostic messages.</p>
    119 </blockquote>
    120 <h4 class="mansect"><a name="tag_20_126_12" id="tag_20_126_12"></a>OUTPUT FILES</h4>
    121 <blockquote>
    122 <p>None.</p>
    123 </blockquote>
    124 <h4 class="mansect"><a name="tag_20_126_13" id="tag_20_126_13"></a>EXTENDED DESCRIPTION</h4>
    125 <blockquote>
    126 <p>The operands <i>string1</i> and <i>string2</i> (if specified) define two arrays of characters. The constructs in the following
    127 list can be used to specify characters or single-character collating elements. If any of the constructs result in multi-character
    128 collating elements, <i>tr</i> shall exclude, without a diagnostic, those multi-character elements from the resulting array.</p>
    129 <dl compact>
    130 <dd></dd>
    131 <dt><i>character</i></dt>
    132 <dd>Any character not described by one of the conventions below shall represent itself.</dd>
    133 <dt>\<i>octal</i></dt>
    134 <dd>Octal sequences can be used to represent characters with specific coded values. An octal sequence shall consist of a
    135 &lt;backslash&gt; followed by the longest sequence of one, two, or three-octal-digit characters (01234567). The sequence shall
    136 cause the value whose encoding is represented by the one, two, or three-digit octal integer to be placed into the array. Multi-byte
    137 characters require multiple, concatenated escape sequences of this type, including the leading &lt;backslash&gt; for each
    138 byte.</dd>
    139 <dt>\<i>character</i></dt>
    140 <dd>The &lt;backslash&gt;-escape sequences in XBD <a href="../basedefs/V1_chap05.html#tagtcjh_2"><i>Escape Sequences and Associated
    141 Actions</i></a> (<tt>'\\'</tt>, <tt>'\a'</tt>, <tt>'\b'</tt>, <tt>'\f'</tt>, <tt>'\n'</tt>, <tt>'\r'</tt>, <tt>'\t'</tt>,
    142 <tt>'\v'</tt>) shall be supported. The results of using any other character, other than an octal digit, following the
    143 &lt;backslash&gt; are unspecified. Also, if there is no character following the &lt;backslash&gt;, the results are
    144 unspecified.</dd>
    145 <dt><i>c</i>-<i>c</i></dt>
    146 <dd>In the POSIX locale, this construct shall represent the range of collating elements between the range endpoints (as long as
    147 neither endpoint is an octal sequence of the form \<i>octal</i>), inclusive, as defined by the collation sequence. The characters
    148 or collating elements in the range shall be placed in the array in ascending collation sequence. If the second endpoint precedes
    149 the starting endpoint in the collation sequence, it is unspecified whether the range of collating elements is empty, or this
    150 construct is treated as invalid. In locales other than the POSIX locale, this construct has unspecified behavior.
    151 <p>If either or both of the range endpoints are octal sequences of the form \<i>octal</i>, this shall represent the range of
    152 specific coded values between the two range endpoints, inclusive.</p>
    153 </dd>
    154 <dt>[:<i>class</i>:]</dt>
    155 <dd>Represents all characters belonging to the defined character class, as defined by the current setting of the <i>LC_CTYPE</i>
    156 locale category. The following character class names shall be accepted when specified in <i>string1</i>:
    157 <table cellpadding="3">
    158 <tr valign="top">
    159 <td align="left">
    160 <p class="tent"><b>alnum</b></p>
    161 </td>
    162 <td align="left">
    163 <p class="tent"><b>blank</b></p>
    164 </td>
    165 <td align="left">
    166 <p class="tent"><b>digit</b></p>
    167 </td>
    168 <td align="left">
    169 <p class="tent"><b>lower</b></p>
    170 </td>
    171 <td align="left">
    172 <p class="tent"><b>punct</b></p>
    173 </td>
    174 <td align="left">
    175 <p class="tent"><b>upper</b></p>
    176 </td>
    177 </tr>
    178 <tr valign="top">
    179 <td align="left">
    180 <p class="tent"><b>alpha</b></p>
    181 </td>
    182 <td align="left">
    183 <p class="tent"><b>cntrl</b></p>
    184 </td>
    185 <td align="left">
    186 <p class="tent"><b>graph</b></p>
    187 </td>
    188 <td align="left">
    189 <p class="tent"><b>print</b></p>
    190 </td>
    191 <td align="left">
    192 <p class="tent"><b>space</b></p>
    193 </td>
    194 <td align="left">
    195 <p class="tent"><b>xdigit</b></p>
    196 </td>
    197 </tr>
    198 </table>
    199 <p class="tent"><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
    200 border="0"> In addition, character class expressions of the form [:<i>name</i>:] shall be recognized in those locales where the
    201 <i>name</i> keyword has been given a <b>charclass</b> definition in the <i>LC_CTYPE</i> category. <img src="../images/opt-end.gif"
    202 alt="[Option End]" border="0"></p>
    203 <p class="tent">When both the <b>-d</b> and <b>-s</b> options are specified, any of the character class names shall be accepted in
    204 <i>string2</i>. Otherwise, only character class names <b>lower</b> or <b>upper</b> are valid in <i>string2</i> and then only if the
    205 corresponding character class (<b>upper</b> and <b>lower</b>, respectively) is specified in the same relative position in
    206 <i>string1</i>. Such a specification shall be interpreted as a request for case conversion. When [:<i>lower</i>:] appears in
    207 <i>string1</i> and [:<i>upper</i>:] appears in <i>string2</i>, the arrays shall contain the characters from the <b>toupper</b>
    208 mapping in the <i>LC_CTYPE</i> category of the current locale. When [:<i>upper</i>:] appears in <i>string1</i> and [:<i>lower</i>:]
    209 appears in <i>string2</i>, the arrays shall contain the characters from the <b>tolower</b> mapping in the <i>LC_CTYPE</i> category
    210 of the current locale. The first character from each mapping pair shall be in the array for <i>string1</i> and the second character
    211 from each mapping pair shall be in the array for <i>string2</i> in the same relative position.</p>
    212 <p class="tent">Except for case conversion, the characters specified by a character class expression shall be placed in the array
    213 in an unspecified order.</p>
    214 <p class="tent">If the name specified for <i>class</i> does not define a valid character class in the current locale, the behavior
    215 is undefined.</p>
    216 </dd>
    217 <dt>[=<i>equiv</i>=]</dt>
    218 <dd>Represents all characters or collating elements belonging to the same equivalence class as <i>equiv</i>, as defined by the
    219 current setting of the <i>LC_COLLATE</i> locale category. An equivalence class expression shall be allowed only in <i>string1</i>,
    220 or in <i>string2</i> when it is being used by the combined <b>-d</b> and <b>-s</b> options. The characters belonging to the
    221 equivalence class shall be placed in the array in an unspecified order.</dd>
    222 <dt>[<i>x</i>*<i>n</i>]</dt>
    223 <dd>Represents <i>n</i> repeated occurrences of the character <i>x</i>. Because this expression is used to map multiple characters
    224 to one, it is only valid when it occurs in <i>string2</i>. If <i>n</i> is omitted or is zero, it shall be interpreted as large
    225 enough to extend the <i>string2</i>-based sequence to the length of the <i>string1</i>-based sequence. If <i>n</i> has a leading
    226 zero, it shall be interpreted as an octal value. Otherwise, it shall be interpreted as a decimal value.</dd>
    227 </dl>
    228 <p class="tent">When the <b>-d</b> option is not specified:</p>
    229 <ul>
    230 <li class="tent">If <i>string2</i> is present, each input character found in the array specified by <i>string1</i> shall be
    231 replaced by the character in the same relative position in the array specified by <i>string2</i>. If the array specified by
    232 <i>string2</i> is shorter that the one specified by <i>string1</i>, or if a character occurs more than once in <i>string1</i>, the
    233 results are unspecified.</li>
    234 <li class="tent">If the <b>-C</b> option is specified, the complements of the characters specified by <i>string1</i> (the set of
    235 all characters in the current character set, as defined by the current setting of <i>LC_CTYPE ,</i> except for those actually
    236 specified in the <i>string1</i> operand) shall be placed in the array in ascending collation sequence, as defined by the current
    237 setting of <i>LC_COLLATE .</i></li>
    238 <li class="tent">If the <b>-c</b> option is specified, the complement of the values specified by <i>string1</i> shall be placed in
    239 the array in ascending order by binary value.</li>
    240 <li class="tent">Because the order in which characters specified by character class expressions or equivalence class expressions is
    241 undefined, such expressions should only be used if the intent is to map several characters into one. An exception is case
    242 conversion, as described previously.</li>
    243 </ul>
    244 <p class="tent">When the <b>-d</b> option is specified:</p>
    245 <ul>
    246 <li class="tent">Input characters found in the array specified by <i>string1</i> shall be deleted.</li>
    247 <li class="tent">When the <b>-C</b> option is specified with <b>-d</b>, all characters except those specified by <i>string1</i>
    248 shall be deleted. The contents of <i>string2</i> are ignored, unless the <b>-s</b> option is also specified.</li>
    249 <li class="tent">When the <b>-c</b> option is specified with <b>-d</b>, all values except those specified by <i>string1</i> shall
    250 be deleted. The contents of <i>string2</i> shall be ignored, unless the <b>-s</b> option is also specified.</li>
    251 <li class="tent">The same string cannot be used for both the <b>-d</b> and the <b>-s</b> option; when both options are specified,
    252 both <i>string1</i> (used for deletion) and <i>string2</i> (used for squeezing) shall be required.</li>
    253 </ul>
    254 <p class="tent">When the <b>-s</b> option is specified, after any deletions or translations have taken place, repeated sequences of
    255 the same character shall be replaced by one occurrence of the same character, if the character is found in the array specified by
    256 the last operand. If the last operand contains a character class, such as the following example:</p>
    257 <pre>
    258 <tt>tr -s '[:space:]'
    259 </tt></pre>
    260 <p class="tent">the last operand's array shall contain all of the characters in that character class. However, in a case
    261 conversion, as described previously, such as:</p>
    262 <pre>
    263 <tt>tr -s '[:upper:]' '[:lower:]'
    264 </tt></pre>
    265 <p class="tent">the last operand's array shall contain only those characters defined as the second characters in each of the
    266 <b>toupper</b> or <b>tolower</b> character pairs, as appropriate.</p>
    267 <p class="tent">An empty string used for <i>string1</i> or <i>string2</i> produces undefined results.</p>
    268 </blockquote>
    269 <h4 class="mansect"><a name="tag_20_126_14" id="tag_20_126_14"></a>EXIT STATUS</h4>
    270 <blockquote>
    271 <p>The following exit values shall be returned:</p>
    272 <dl compact>
    273 <dd></dd>
    274 <dt>&nbsp;0</dt>
    275 <dd>All input was processed successfully.</dd>
    276 <dt>&gt;0</dt>
    277 <dd>An error occurred.</dd>
    278 </dl>
    279 </blockquote>
    280 <h4 class="mansect"><a name="tag_20_126_15" id="tag_20_126_15"></a>CONSEQUENCES OF ERRORS</h4>
    281 <blockquote>
    282 <p>Default.</p>
    283 </blockquote>
    284 <hr>
    285 <div class="box"><em>The following sections are informative.</em></div>
    286 <h4 class="mansect"><a name="tag_20_126_16" id="tag_20_126_16"></a>APPLICATION USAGE</h4>
    287 <blockquote>
    288 <p>If necessary, <i>string1</i> and <i>string2</i> can be quoted to avoid pattern matching by the shell.</p>
    289 <p class="tent">If an ordinary digit (representing itself) is to follow an octal sequence, the octal sequence must use the full
    290 three digits to avoid ambiguity.</p>
    291 <p class="tent">When <i>string2</i> is shorter than <i>string1</i>, a difference results between historical System&nbsp;V and BSD
    292 systems. A BSD system pads <i>string2</i> with the last character found in <i>string2</i>. Thus, it is possible to do the
    293 following:</p>
    294 <pre>
    295 <tt>tr 0123456789 d
    296 </tt></pre>
    297 <p class="tent">which would translate all digits to the letter <tt>'d'</tt>. Since this area is specifically unspecified in this
    298 volume of POSIX.1-2024, both the BSD and System&nbsp;V behaviors are allowed, but a conforming application cannot rely on the BSD
    299 behavior. It would have to code the example in the following way:</p>
    300 <pre>
    301 <tt>tr 0123456789 '[d*]'
    302 </tt></pre>
    303 <p class="tent">It should be noted that, despite similarities in appearance, the string operands used by <i>tr</i> are not regular
    304 expressions.</p>
    305 <p class="tent">Unlike some historical implementations, this definition of the <i>tr</i> utility correctly processes NUL characters
    306 in its input stream. NUL characters can be stripped by using:</p>
    307 <pre>
    308 <tt>tr -d '\000'
    309 </tt></pre></blockquote>
    310 <h4 class="mansect"><a name="tag_20_126_17" id="tag_20_126_17"></a>EXAMPLES</h4>
    311 <blockquote>
    312 <ol>
    313 <li class="tent">The following example creates a list of all words in <b>file1</b> one per line in <b>file2</b>, where a word is
    314 taken to be a maximal string of letters.
    315 <pre>
    316 <tt>tr -cs "[:alpha:]" "[\n*]" &lt;file1 &gt;file2
    317 </tt></pre></li>
    318 <li class="tent">The next example translates all lowercase characters in <b>file1</b> to uppercase and writes the results to
    319 standard output.
    320 <pre>
    321 <tt>tr "[:lower:]" "[:upper:]" &lt;file1
    322 </tt></pre></li>
    323 <li class="tent">This example uses an equivalence class to identify accented variants of the base character <tt>'e'</tt> in
    324 <b>file1</b>, which are stripped of diacritical marks and written to <b>file2</b>.
    325 <pre>
    326 <tt>tr "[=e=]" "[e*]" &lt;file1 &gt;file2
    327 </tt></pre></li>
    328 </ol>
    329 </blockquote>
    330 <h4 class="mansect"><a name="tag_20_126_18" id="tag_20_126_18"></a>RATIONALE</h4>
    331 <blockquote>
    332 <p>In some early proposals, an explicit option <b>-n</b> was added to disable the historical behavior of stripping NUL characters
    333 from the input. It was considered that automatically stripping NUL characters from the input was not correct functionality.
    334 However, the removal of <b>-n</b> in a later proposal does not remove the requirement that <i>tr</i> correctly process NUL
    335 characters in its input stream. NUL characters can be stripped by using <i>tr</i> <b>-d</b> '\000'.</p>
    336 <p class="tent">Historical implementations of <i>tr</i> differ widely in syntax and behavior. For example, the BSD version has not
    337 needed the bracket characters for the repetition sequence. The <i>tr</i> utility syntax is based more closely on the System V and
    338 XPG3 model while attempting to accommodate historical BSD implementations. In the case of the short <i>string2</i> padding, the
    339 decision was to unspecify the behavior and preserve System V and XPG3 scripts, which might find difficulty with the BSD method. The
    340 assumption was made that BSD users of <i>tr</i> have to make accommodations to meet the syntax defined here. Since it is possible
    341 to use the repetition sequence to duplicate the desired behavior, whereas there is no simple way to achieve the System V method,
    342 this was the correct, if not desirable, approach.</p>
    343 <p class="tent">The use of octal values to specify control characters, while having historical precedents, is not portable. The
    344 introduction of escape sequences for control characters should provide the necessary portability. It is recognized that this may
    345 cause some historical scripts to break.</p>
    346 <p class="tent">An early proposal included support for multi-character collating elements. It was pointed out that, while <i>tr</i>
    347 does employ some syntactical elements from REs, the aim of <i>tr</i> is quite different; ranges, for example, do not have a similar
    348 meaning (&quot;any of the chars in the range matches&quot;, <i>versus</i> &quot;translate each character in the range to the output
    349 counterpart&quot;). As a result, the previously included support for multi-character collating elements has been removed. What remains
    350 are ranges in current collation order (to support, for example, accented characters), character classes, and equivalence
    351 classes.</p>
    352 <p class="tent">In XPG3 the [:<i>class</i>:] and [=<i>equiv</i>=] conventions are shown with double brackets, as in RE syntax.
    353 However, <i>tr</i> does not implement RE principles; it just borrows part of the syntax. Consequently, [:<i>class</i>:] and
    354 [=<i>equiv</i>=] should be regarded as syntactical elements on a par with [<i>x</i>*<i>n</i>], which is not an RE bracket
    355 expression.</p>
    356 <p class="tent">The standard developers will consider changes to <i>tr</i> that allow it to translate characters between different
    357 character encodings, or they will consider providing a new utility to accomplish this.</p>
    358 <p class="tent">On historical System V systems, a range expression requires enclosing square-brackets, such as:</p>
    359 <pre>
    360 <tt>tr '[a-z]' '[A-Z]'
    361 </tt></pre>
    362 <p class="tent">However, BSD-based systems did not require the brackets, and this convention is used here to avoid breaking large
    363 numbers of BSD scripts:</p>
    364 <pre>
    365 <tt>tr a-z A-Z
    366 </tt></pre>
    367 <p class="tent">The preceding System V script will continue to work because the brackets, treated as regular characters, are
    368 translated to themselves. However, any System V script that relied on <tt>"a-z"</tt> representing the three characters
    369 <tt>'a'</tt>, <tt>'-'</tt>, and <tt>'z'</tt> have to be rewritten as <tt>"az-"</tt>.</p>
    370 <p class="tent">The ISO&nbsp;POSIX-2:1993 standard had a <b>-c</b> option that behaved similarly to the <b>-C</b> option, but did
    371 not supply functionality equivalent to the <b>-c</b> option specified in POSIX.1-2024.</p>
    372 <p class="tent">The earlier version also said that octal sequences referred to collating elements and could be placed adjacent to
    373 each other to specify multi-byte characters. However, it was noted that this caused ambiguities because <i>tr</i> would not be able
    374 to tell whether adjacent octal sequences were intending to specify multi-byte characters or multiple single byte characters.
    375 POSIX.1-2024 specifies that octal sequences always refer to single byte binary values when used to specify an endpoint of a range
    376 of collating elements.</p>
    377 <p class="tent">Earlier versions of this standard allowed for implementations with bytes other than eight bits, but this has been
    378 modified in this version.</p>
    379 </blockquote>
    380 <h4 class="mansect"><a name="tag_20_126_19" id="tag_20_126_19"></a>FUTURE DIRECTIONS</h4>
    381 <blockquote>
    382 <p>None.</p>
    383 </blockquote>
    384 <h4 class="mansect"><a name="tag_20_126_20" id="tag_20_126_20"></a>SEE ALSO</h4>
    385 <blockquote>
    386 <p><a href="../utilities/sed.html#"><i>sed</i></a></p>
    387 <p class="tent">XBD <a href="../basedefs/V1_chap05.html#tagtcjh_2"><i>Escape Sequences and Associated Actions</i></a> , <a href=
    388 "../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2
    389 Utility Syntax Guidelines</i></a></p>
    390 </blockquote>
    391 <h4 class="mansect"><a name="tag_20_126_21" id="tag_20_126_21"></a>CHANGE HISTORY</h4>
    392 <blockquote>
    393 <p>First released in Issue 2.</p>
    394 </blockquote>
    395 <h4 class="mansect"><a name="tag_20_126_22" id="tag_20_126_22"></a>Issue 6</h4>
    396 <blockquote>
    397 <p>The <b>-C</b> operand is added, and the description of the <b>-c</b> operand is changed to align with the IEEE&nbsp;P1003.2b
    398 draft standard.</p>
    399 <p class="tent">The normative text is reworded to avoid use of the term &quot;must&quot; for application requirements.</p>
    400 <p class="tent">IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XCU/TC2/D6/31 is applied, removing text describing behavior on
    401 systems with bytes consisting of more than eight bits.</p>
    402 <p class="tent">IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XCU/TC2/D6/32 is applied, updating an example in the EXAMPLES
    403 section to avoid using unspecified behavior.</p>
    404 <p class="tent">IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XCU/TC2/D6/33 is applied, making a correction to the
    405 RATIONALE.</p>
    406 </blockquote>
    407 <h4 class="mansect"><a name="tag_20_126_23" id="tag_20_126_23"></a>Issue 7</h4>
    408 <blockquote>
    409 <p>SD5-XCU-ERN-30 is applied.</p>
    410 <p class="tent">SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.<br></p>
    411 <p class="tent">Austin Group Interpretation 1003.1-2001 #132 is applied, adding rationale to the \<i>character</i> construct.</p>
    412 <p class="tent">POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0145 [325] is applied.</p>
    413 <p class="tent">POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0196 [663] is applied.</p>
    414 </blockquote>
    415 <h4 class="mansect"><a name="tag_20_126_24" id="tag_20_126_24"></a>Issue 8</h4>
    416 <blockquote>
    417 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    418 </blockquote>
    419 <div class="box"><em>End of informative text.</em></div>
    420 <hr>
    421 <p>&nbsp;</p>
    422 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    423 <hr size="2" noshade>
    424 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    425 POSIX™ is a Trademark of The IEEE.<br>
    426 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    427 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    428 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    429 ]</font></center>
    430 <hr size="2" noshade>
    431 <div class="NAVHEADER">
    432 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    433 <tr class="nav">
    434 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/tput.html" accesskey="P">&lt;&lt;&lt;
    435 Previous</a></td>
    436 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    437 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/true.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    438 </tr>
    439 </table>
    440 <hr align="left" width="100%"></div>
    441 </body>
    442 </html>