Rev | Line | |
---|
[9] | 1 | .TH TR 1
|
---|
| 2 | .SH NAME
|
---|
| 3 | tr \- translate character codes
|
---|
| 4 | .SH SYNOPSIS
|
---|
| 5 | \fBtr\fR [\fB\-cds\fR]\fR [\fIstring1\fR] [\fIstring2\fR]\fR
|
---|
| 6 | .br
|
---|
| 7 | .de FL
|
---|
| 8 | .TP
|
---|
| 9 | \\fB\\$1\\fR
|
---|
| 10 | \\$2
|
---|
| 11 | ..
|
---|
| 12 | .de EX
|
---|
| 13 | .TP 20
|
---|
| 14 | \\fB\\$1\\fR
|
---|
| 15 | # \\$2
|
---|
| 16 | ..
|
---|
| 17 | .SH OPTIONS
|
---|
| 18 | .FL "\-c" "Complement the set of characters in \fIstring1\fR"
|
---|
| 19 | .FL "\-d" "Delete all characters specified in \fIstring1\fR"
|
---|
| 20 | .FL "\-s" "Squeeze all runs of characters in \fIstring1\fR to one character"
|
---|
| 21 | .SH EXAMPLES
|
---|
| 22 | .EX "tr \(fmA\-Z\(fm \(fma\-z\(fm <x >y " "Convert upper case to lower case"
|
---|
| 23 | .EX "tr \-d \(fm0123456789\(fm <f1 >f2 " "Delete all digits from \fIf1\fR"
|
---|
| 24 | .SH DESCRIPTION
|
---|
| 25 | .PP
|
---|
| 26 | .I Tr
|
---|
| 27 | performs simple character translation.
|
---|
| 28 | When no flag is specified, each character in
|
---|
| 29 | .I string1
|
---|
| 30 | is mapped onto the corresponding character in
|
---|
| 31 | .I string2 .
|
---|
| 32 | .PP
|
---|
| 33 | There are two types of
|
---|
| 34 | .I tr
|
---|
| 35 | out there, one that requires [ and ] for character classes, and one that does
|
---|
| 36 | not. Here is what the example above would look like for a
|
---|
| 37 | .I tr
|
---|
| 38 | that needs the brackets:
|
---|
| 39 | .PP
|
---|
| 40 | .RS
|
---|
| 41 | .B "tr \(fm[A\-Z]\(fm \(fm[a\-z]\(fm <x >y"
|
---|
| 42 | .RE
|
---|
| 43 | .PP
|
---|
| 44 | Use [ and ] if you want to be portable, because a
|
---|
| 45 | .I tr
|
---|
| 46 | that doesn't need them will still accept the syntax and mindlessly
|
---|
| 47 | translate [ into [ and ] into ].
|
---|
Note:
See
TracBrowser
for help on using the repository browser.