tr.1 (9b50d9027575220cb6dd09b3e62f03f511e908b8) tr.1 (af647767ed8f2ec38251e8185ef0b6adb35529e6)
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

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

53.Fl s
54.Ar string1
55.Nm tr
56.Op Fl c
57.Fl ds
58.Ar string1 string2
59.Sh DESCRIPTION
60The
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

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

53.Fl s
54.Ar string1
55.Nm tr
56.Op Fl c
57.Fl ds
58.Ar string1 string2
59.Sh DESCRIPTION
60The
61.Nm tr
61.Nm
62utility copies the standard input to the standard output with substitution
63or deletion of selected characters.
64.Pp
65The following options are available:
66.Bl -tag -width Ds
67.It Fl c
68Complements the set of characters in
69.Ar string1 ,

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

220.Ar string1 .
221If
222.Ar n
223has a leading zero, it is interpreted as an octal value, otherwise,
224it's interpreted as a decimal value.
225.El
226.Pp
227The
62utility copies the standard input to the standard output with substitution
63or deletion of selected characters.
64.Pp
65The following options are available:
66.Bl -tag -width Ds
67.It Fl c
68Complements the set of characters in
69.Ar string1 ,

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

220.Ar string1 .
221If
222.Ar n
223has a leading zero, it is interpreted as an octal value, otherwise,
224it's interpreted as a decimal value.
225.El
226.Pp
227The
228.Nm tr
228.Nm
229utility exits 0 on success, and >0 if an error occurs.
230.Sh EXAMPLES
231The following examples are shown as given to the shell:
232.sp
233Create a list of the words in file1, one per line, where a word is taken to
234be a maximal string of letters.
235.sp
236.D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q < file1"

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

256the command ``tr -d [a-z]'', the characters ``['' and ``]'' will be
257included in the deletion or compression list which would not have happened
258under an historic System V implementation.
259Additionally, any scripts that depended on the sequence ``a-z'' to
260represent the three characters ``a'', ``-'' and ``z'' will have to be
261rewritten as ``a\e-z''.
262.Pp
263The
229utility exits 0 on success, and >0 if an error occurs.
230.Sh EXAMPLES
231The following examples are shown as given to the shell:
232.sp
233Create a list of the words in file1, one per line, where a word is taken to
234be a maximal string of letters.
235.sp
236.D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q < file1"

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

256the command ``tr -d [a-z]'', the characters ``['' and ``]'' will be
257included in the deletion or compression list which would not have happened
258under an historic System V implementation.
259Additionally, any scripts that depended on the sequence ``a-z'' to
260represent the three characters ``a'', ``-'' and ``z'' will have to be
261rewritten as ``a\e-z''.
262.Pp
263The
264.Nm tr
264.Nm
265utility has historically not permitted the manipulation of NUL bytes in
266its input and, additionally, stripped NUL's from its input stream.
267This implementation has removed this behavior as a bug.
268.Pp
269The
265utility has historically not permitted the manipulation of NUL bytes in
266its input and, additionally, stripped NUL's from its input stream.
267This implementation has removed this behavior as a bug.
268.Pp
269The
270.Nm tr
270.Nm
271utility has historically been extremely forgiving of syntax errors,
272for example, the
273.Fl c
274and
275.Fl s
276options were ignored unless two strings were specified.
277This implementation will not permit illegal syntax.
278.Sh STANDARDS
279The
271utility has historically been extremely forgiving of syntax errors,
272for example, the
273.Fl c
274and
275.Fl s
276options were ignored unless two strings were specified.
277This implementation will not permit illegal syntax.
278.Sh STANDARDS
279The
280.Nm tr
280.Nm
281utility is expected to be
282.St -p1003.2
283compatible.
284It should be noted that the feature wherein the last character of
285.Ar string2
286is duplicated if
287.Ar string2
288has less characters than
289.Ar string1
290is permitted by POSIX but is not required.
291Shell scripts attempting to be portable to other POSIX systems should use
292the ``[#*]'' convention instead of relying on this behavior.
281utility is expected to be
282.St -p1003.2
283compatible.
284It should be noted that the feature wherein the last character of
285.Ar string2
286is duplicated if
287.Ar string2
288has less characters than
289.Ar string1
290is permitted by POSIX but is not required.
291Shell scripts attempting to be portable to other POSIX systems should use
292the ``[#*]'' convention instead of relying on this behavior.