16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

tr<br />

Usage notes<br />

Examples<br />

tr ’a-z’ ’A-Z’<br />

This is not, however, the recommended method; use the [:class:]<br />

construct instead.<br />

If the second endpoint precedes the starting endpoint in the collation<br />

sequence, it causes an error.<br />

If either or both of the range endpoints are octal sequences of the form<br />

\ooo, this represents the range of specific coded values between the two<br />

range endpoints, inclusive.<br />

This construct c1–c2 is only applied in P<strong>OS</strong>IX locale.<br />

Note: The current locale has a significant effect on results when specifying<br />

subranges using this method. If the command is required to give<br />

consistent results irrespective of locale, the use of construct c1-c2<br />

should be avoided.<br />

[c*n] This represents n repeated occurrences of character c. (If n has a leading<br />

zero, tr assumes it is octal; otherwise, it is assumed to be decimal.) You<br />

can omit the number for the last character in a subset. This representation<br />

is valid only in string2.<br />

[:class:]<br />

This represents all characters that belong to the character class class in the<br />

locale indicated by LC_CTYPE. When the class [:upper] or [:lower:]<br />

appears in string1 and the opposite class, [:lower:] or [:upper:] appears<br />

in string2, tr uses the LC_CTYPE tolower or toupper mappings in the<br />

same relative positions.<br />

[=c=] This represents all characters that belong to the same equivalence class as<br />

the character c in the locale indicated by LC_COLLATE. Only international<br />

versions of the code support this format.<br />

When string2 is shorter than string1, tr does not pad string2. The remaining<br />

characters in string1 will not be translated. For example:<br />

tr ’0123456789’ ’d’<br />

only translates ’0’ to ’d’, ’123456789’ remain unchanged.<br />

Coding the example in the following way:<br />

tr ’0123456789’ ’[d*]’<br />

translates all digits to the letter ’d’.<br />

This example creates a list of all words (strings of letters) found in file1 and puts it<br />

in file2:<br />

tr –cs "[:alpha:]" "[\n*]" file2<br />

Environment variables<br />

tr uses the following environment variable:<br />

706 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!