tr.1 (0b651019b450cfc36d4a483f56fd015ee7c09234) tr.1 (26bdc1d12e201268494ef5c5caa40645cb222fa6)
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 195 unchanged lines hidden (view full) ---

204.\" .Fl s
205.\" options are specified.
206.\" Otherwise, only the classes ``upper'' and ``lower'' may be used in
207.\" .Ar string2
208.\" and then only when the corresponding class (``upper'' for ``lower''
209.\" and vice-versa) is specified in the same relative position in
210.\" .Ar string1 .
211.\" .Pp
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 195 unchanged lines hidden (view full) ---

204.\" .Fl s
205.\" options are specified.
206.\" Otherwise, only the classes ``upper'' and ``lower'' may be used in
207.\" .Ar string2
208.\" and then only when the corresponding class (``upper'' for ``lower''
209.\" and vice-versa) is specified in the same relative position in
210.\" .Ar string1 .
211.\" .Pp
212When ``[:lower:]'' appears in
212When
213.Dq Li [:lower:]
214appears in
213.Ar string1
215.Ar string1
214and ``[:upper:]'' appears in the same relative position in
216and
217.Dq Li [:upper:]
218appears in the same relative position in
215.Ar string2 ,
216it represents the characters pairs from the
217.Dv toupper
218mapping in the
219.Ev LC_CTYPE
220category of the current locale.
219.Ar string2 ,
220it represents the characters pairs from the
221.Dv toupper
222mapping in the
223.Ev LC_CTYPE
224category of the current locale.
221When ``[:upper:]'' appears in
225When
226.Dq Li [:upper:]
227appears in
222.Ar string1
228.Ar string1
223and ``[:lower:]'' appears in the same relative position in
229and
230.Dq Li [:lower:]
231appears in the same relative position in
224.Ar string2 ,
225it represents the characters pairs from the
226.Dv tolower
227mapping in the
228.Ev LC_CTYPE
229category of the current locale.
230.Pp
231With the exception of case conversion,

--- 89 unchanged lines hidden (view full) ---

321and
322.Ql "[:upper:]"
323should be used instead of explicit character ranges like
324.Ql "a-z"
325and
326.Ql "A-Z" .
327.Pp
328System V has historically implemented character ranges using the syntax
232.Ar string2 ,
233it represents the characters pairs from the
234.Dv tolower
235mapping in the
236.Ev LC_CTYPE
237category of the current locale.
238.Pp
239With the exception of case conversion,

--- 89 unchanged lines hidden (view full) ---

329and
330.Ql "[:upper:]"
331should be used instead of explicit character ranges like
332.Ql "a-z"
333and
334.Ql "A-Z" .
335.Pp
336System V has historically implemented character ranges using the syntax
329``[c-c]'' instead of the ``c-c'' used by historic
337.Dq Li [c-c]
338instead of the
339.Dq Li c-c
340used by historic
330.Bx
331implementations and
332standardized by POSIX.
333System V shell scripts should work under this implementation as long as
334the range is intended to map in another range, i.e., the command
341.Bx
342implementations and
343standardized by POSIX.
344System V shell scripts should work under this implementation as long as
345the range is intended to map in another range, i.e., the command
335``tr [a-z] [A-Z]'' will work as it will map the ``['' character in
346.Dq Li "tr [a-z] [A-Z]"
347will work as it will map the
348.Ql \&[
349character in
336.Ar string1
350.Ar string1
337to the ``['' character in
351to the
352.Ql \&[
353character in
338.Ar string2 .
339However, if the shell script is deleting or squeezing characters as in
354.Ar string2 .
355However, if the shell script is deleting or squeezing characters as in
340the command ``tr -d [a-z]'', the characters ``['' and ``]'' will be
356the command
357.Dq Li "tr -d [a-z]" ,
358the characters
359.Ql \&[
360and
361.Ql \&]
362will be
341included in the deletion or compression list which would not have happened
342under a historic System V implementation.
363included in the deletion or compression list which would not have happened
364under a historic System V implementation.
343Additionally, any scripts that depended on the sequence ``a-z'' to
344represent the three characters ``a'', ``-'' and ``z'' will have to be
345rewritten as ``a\e-z''.
365Additionally, any scripts that depended on the sequence
366.Dq Li a-z
367to
368represent the three characters
369.Ql a ,
370.Ql \&-
371and
372.Ql z
373will have to be
374rewritten as
375.Dq Li a\e-z .
346.Pp
347The
348.Nm
349utility has historically not permitted the manipulation of NUL bytes in
350its input and, additionally, stripped NUL's from its input stream.
351This implementation has removed this behavior as a bug.
352.Pp
353The

--- 14 unchanged lines hidden (view full) ---

368It should be noted that the feature wherein the last character of
369.Ar string2
370is duplicated if
371.Ar string2
372has less characters than
373.Ar string1
374is permitted by POSIX but is not required.
375Shell scripts attempting to be portable to other POSIX systems should use
376.Pp
377The
378.Nm
379utility has historically not permitted the manipulation of NUL bytes in
380its input and, additionally, stripped NUL's from its input stream.
381This implementation has removed this behavior as a bug.
382.Pp
383The

--- 14 unchanged lines hidden (view full) ---

398It should be noted that the feature wherein the last character of
399.Ar string2
400is duplicated if
401.Ar string2
402has less characters than
403.Ar string1
404is permitted by POSIX but is not required.
405Shell scripts attempting to be portable to other POSIX systems should use
376the ``[#*]'' convention instead of relying on this behavior.
406the
407.Dq Li [#*]
408convention instead of relying on this behavior.
377The
378.Fl u
379option is an extension to the
380.St -p1003.1-2001
381standard.
409The
410.Fl u
411option is an extension to the
412.St -p1003.1-2001
413standard.