tr.1 (26bdc1d12e201268494ef5c5caa40645cb222fa6) tr.1 (3baccdb9fd44df1dd289f49ec2a7a0e25064d45e)
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

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

166represents the range of characters between the range endpoints, inclusive,
167in ascending order,
168as defined by the collation sequence.
169If either or both of the range endpoints are octal sequences, it
170represents the range of specific coded values between the
171range endpoints, inclusive.
172.Pp
173.Bf Em
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

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

166represents the range of characters between the range endpoints, inclusive,
167in ascending order,
168as defined by the collation sequence.
169If either or both of the range endpoints are octal sequences, it
170represents the range of specific coded values between the
171range endpoints, inclusive.
172.Pp
173.Bf Em
174See the COMPATIBILITY section below for an important note regarding
174See the
175.Sx COMPATIBILITY
176section below for an important note regarding
175differences in the way the current
176implementation interprets range expressions differently from
177previous implementations.
178.Ef
179.It [:class:]
180Represents all characters belonging to the defined character class.
181Class names are:
182.Pp

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

287.Pp
288Translate the contents of file1 to upper-case.
289.Pp
290.D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q < file1"
291.Pp
292(This should be preferred over the traditional
293.Ux
294idiom of
177differences in the way the current
178implementation interprets range expressions differently from
179previous implementations.
180.Ef
181.It [:class:]
182Represents all characters belonging to the defined character class.
183Class names are:
184.Pp

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

289.Pp
290Translate the contents of file1 to upper-case.
291.Pp
292.D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q < file1"
293.Pp
294(This should be preferred over the traditional
295.Ux
296idiom of
295.Ql "tr a-z A-Z" ,
297.Dq Li "tr a-z A-Z" ,
296since it works correctly in all locales.)
297.Pp
298Strip out non-printable characters from file1.
299.Pp
300.D1 Li "tr -cd \*q[:print:]\*q < file1"
301.Pp
302Remove diacritical marks from all accented variants of the letter
303.Ql e :
304.Pp
305.Dl "tr \*q[=e=]\*q \*qe\*q"
306.Sh DIAGNOSTICS
307.Ex -std
308.Sh COMPATIBILITY
309Previous
310.Fx
311implementations of
312.Nm
313did not order characters in range expressions according to the current
314locale's collation order, making it possible to convert unaccented Latin
298since it works correctly in all locales.)
299.Pp
300Strip out non-printable characters from file1.
301.Pp
302.D1 Li "tr -cd \*q[:print:]\*q < file1"
303.Pp
304Remove diacritical marks from all accented variants of the letter
305.Ql e :
306.Pp
307.Dl "tr \*q[=e=]\*q \*qe\*q"
308.Sh DIAGNOSTICS
309.Ex -std
310.Sh COMPATIBILITY
311Previous
312.Fx
313implementations of
314.Nm
315did not order characters in range expressions according to the current
316locale's collation order, making it possible to convert unaccented Latin
315characters (esp. as found in English text) from upper to lower case using
317characters (esp.\& as found in English text) from upper to lower case using
316the traditional
317.Ux
318idiom of
318the traditional
319.Ux
320idiom of
319.Ql "tr A-Z a-z" .
321.Dq Li "tr A-Z a-z" .
320Since
321.Nm
322now obeys the locale's collation order, this idiom may not produce
323correct results when there is not a 1:1 mapping between lower and
324upper case, or when the order of characters within the two cases differs.
325As noted in the
326.Sx EXAMPLES
327section above, the character class expressions
322Since
323.Nm
324now obeys the locale's collation order, this idiom may not produce
325correct results when there is not a 1:1 mapping between lower and
326upper case, or when the order of characters within the two cases differs.
327As noted in the
328.Sx EXAMPLES
329section above, the character class expressions
328.Ql "[:lower:]"
330.Dq Li [:lower:]
329and
331and
330.Ql "[:upper:]"
332.Dq Li [:upper:]
331should be used instead of explicit character ranges like
333should be used instead of explicit character ranges like
332.Ql "a-z"
334.Dq Li a-z
333and
335and
334.Ql "A-Z" .
336.Dq Li A-Z .
335.Pp
336System V has historically implemented character ranges using the syntax
337.Dq Li [c-c]
338instead of the
339.Dq Li c-c
340used by historic
341.Bx
342implementations and

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

362will be
363included in the deletion or compression list which would not have happened
364under a historic System V implementation.
365Additionally, any scripts that depended on the sequence
366.Dq Li a-z
367to
368represent the three characters
369.Ql a ,
337.Pp
338System V has historically implemented character ranges using the syntax
339.Dq Li [c-c]
340instead of the
341.Dq Li c-c
342used by historic
343.Bx
344implementations and

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

364will be
365included in the deletion or compression list which would not have happened
366under a historic System V implementation.
367Additionally, any scripts that depended on the sequence
368.Dq Li a-z
369to
370represent the three characters
371.Ql a ,
370.Ql \&-
372.Ql \-
371and
372.Ql z
373will have to be
374rewritten as
375.Dq Li a\e-z .
376.Pp
377The
378.Nm

--- 35 unchanged lines hidden ---
373and
374.Ql z
375will have to be
376rewritten as
377.Dq Li a\e-z .
378.Pp
379The
380.Nm

--- 35 unchanged lines hidden ---