dec21140A ethernet driver for virtualpc, contributed by nicolas tittley.
[minix.git] / man / man1 / tr.1
blob05794ddea183e8565db1c40197dffd7b03f45bf1
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
12 .de EX
13 .TP 20
14 \\fB\\$1\\fR
15 # \\$2
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 ].
48 .PP
49 MINIX tr supports the following character classes: alnum, alpha, digit, lower,
50 upper and xdigit. If any of these keywords is encountered between backets and 
51 colons, it is replaced by respectively alphanumeric characters, alphabetic
52 characters, decimal digits, lowercase letters, uppercase letters and 
53 hexadecimal digits. The following are equivalent with the given examples:
54 .EX "tr \(fm[:upper:]\(fm \(fm[:lower:]\(fm <x >y     " "Convert upper case to lower case"
55 .EX "tr \-d \(fm[:digit:]\(fm <f1 >f2  " "Delete all digits from \fIf1\fR"