Add mandoc-manpage for tr(1)

and mark it as finished in the README.
This commit is contained in:
FRIGN 2015-01-16 00:53:50 +01:00 committed by sin
parent bab75bfe58
commit 33e2df5206
2 changed files with 77 additions and 68 deletions

2
README
View File

@ -68,7 +68,7 @@ The following tools are implemented (* == finished):
tee no -i tee no -i
test yes none test yes none
touch no -a, -m, -r touch no -a, -m, -r
tr yes none * tr yes none
true yes none true yes none
tty yes none tty yes none
uudecode no -o uudecode no -o

143
tr.1
View File

@ -1,67 +1,76 @@
.TH TR 1 sbase\-VERSION .Dd January 16, 2014
.SH NAME .Dt TR 1 sbase\-VERSION
tr \- translate characters .Sh NAME
.SH SYNOPSIS .Nm tr
.B tr .Nd translate characters
.RB [ \-d ] [ \-c ] .Sh SYNOPSIS
.RB set1 .Nm tr
.P .Op Fl c | Fl C
.B tr .Op Fl sd
.RB set1 .Ar set1 set2
.RI set2 .Sh DESCRIPTION
.SH OPTIONS .Nm
.TP matches characters from stdin and performs translations to stdout.
.B \-d .Sh OPTIONS
For compatibility. If given, characters in set1 will be deleted from the input and specifying set2 will result in an error. .Bl -tag -width Ds
.B \-c .It Fl c | Fl C
Complementary, causes the specified character set to be inverted, this is all the characters not specified belong to it. Match to
It only works in conjunction with \-d, because order doesn't make much sense with translation. .Ar set1
.SH DESCRIPTION complement.
.B tr .It Fl d
reads input from stdin replacing every character in Delete characters matching
.B set1 .Ar set1 .
with the character at the same index in .It Fl s
.B set2. Squeeze repeated characters matching
If set2 is not given .Ar set1
.B tr or
deletes the characters in set1 from the input. .Ar set2
if -d is set.
Sets are specified as strings of characters. Almost all represent themselves but the following ones will be interpreted: .El
.TP .Sh SET
\e\e .Bl -tag -width Ds
backslash .It Literal 'c'
.TP .It Escape sequence '\ec'
\ea \e\e, \ea, \eb, \ef, \en, \er, \et, \ev
audible BEL .It Range 'c-d'
.TP .It Repeat '[c*n]'
\ef Only in
form feed .Ar set2 .
.TP If n = 0 or left out, set n to length of
\en .Ar set1 .
new line .It Character class '[:class:]'
.TP See
\er .Xr wctype 3 .
return .El
.TP .Sh TRANSLATION
\et If no options are specified,
horizontal tab .Nm
.TP translates from
\ev .Ar set1
vertical tab to
.PP .Ar set2
If set1 is longer than set2 by index or character class.
.B tr .Pp
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. If
.B .Ar set2
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, is shorter than
digits will stop being read when a non-octal character or when three characters are read. .Ar set1 ,
.B overflowing characters translate to the last character in
Use "A-B" for ordered sets fom A to B. .Ar set2 .
.B .Sh EXIT STATUS
.SH NOTES .Bl -tag -width Ds
.B tr .It 0
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 Input processed successfully.
classes. .It 1
.SH SEE ALSO An error occurred.
.IR sed(1) .El
.IR awk(1) .Sh SEE ALSO
.Xr sed 1 ,
.Xr awk 1 ,
.Xr utf8 7
.Sh STANDARDS
The
.Nm
utility is compliant with the
.St -p1003.1-2008
except from octal sequences and equivalence classes.