tr

Official Description

Translates characters.

Syntax

tr [-Acs] string1
					string2
				

Options

-A requests ASCII translation, with no extended character sets (might not be available on all UNIX variants).

-c requests the use of the complement of the chars in string1.

-s substitutes characters in string1 into string2.

Oddities

Specifying the -A option improves ASCII performance, but the option might not be available in all UNIX variants.

Example

$ cat funca                  # Note the {}
function funca {
print "In funca"
}
$                            # Change to ( )
$ tr '{}' '()' <funca > funcanew
$
$ cat funcanew               # Note the ( )
function funca (
print "In funca"
)
$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.