sbase/tr.1

68 lines
1.6 KiB
Groff
Raw Normal View History

2013-11-15 16:25:10 +00:00
.TH TR 1 sbase\-VERSION
.SH NAME
tr \- translate characters
.SH SYNOPSIS
.B tr
.RB [ \-d ] [ \-c ]
2013-11-15 16:25:10 +00:00
.RB set1
.P
.B tr
.RB set1
.RI set2
.SH OPTIONS
.TP
.B \-d
For compatibility. If given, characters in set1 will be deleted from the input and specifying set2 will result in an error.
.B \-c
Complementary, causes the specified character set to be inverted, this is all the characters not specified belong to it.
It only works in conjunction with \-d, because order doesn't make much sense with translation.
2013-11-15 16:25:10 +00:00
.SH DESCRIPTION
.B tr
reads input from stdin replacing every character in
.B set1
with the character at the same index in
.B set2.
If set2 is not given
.B tr
deletes the characters in set1 from the input.
Sets are specified as strings of characters. Almost all represent themselves but the following ones will be interpreted:
2013-11-15 16:25:10 +00:00
.TP
\e\e
backslash
.TP
\ea
audible BEL
.TP
\ef
form feed
.TP
\en
new line
.TP
\er
return
.TP
\et
horizontal tab
.TP
\ev
vertical tab
.PP
If set1 is longer than set2
.B tr
will map all the remaining characters to the last one in set2. In case set2 is longer than set1, the remaining characters from set2 will be ignored.
.B
Character escape sequences, be them characters or octal numbers, are done preceding the token with a "\\". You may specify three digits or less for it,
digits will stop being read when a non-octal character or when three characters are read.
.B
Use "A-B" for ordered sets fom A to B.
.B
2013-11-15 16:25:10 +00:00
.SH NOTES
.B tr
is Unicode-aware, but only if you don't specify characters in octal (for example \\012), because else it is not predictable. Does not support character
classes.
2013-11-15 16:25:10 +00:00
.SH SEE ALSO
.IR sed(1)
.IR awk(1)