Charles.Forsyth20060303-partialeea662d19 years agoHistory
95 lines · 1.7 KB · Text
RawDownload
.TH TR 1.SH NAMEtr \- translate characters.SH SYNOPSIS.B tr[.B -cds][.I string1[.I string2]].SH DESCRIPTION.I Trcopies the standard input to the standard output withsubstitution or deletion of selected characters (runes).Input characters found in.I string1are mapped into the corresponding characters of.IR string2 .When.I string2is short it is padded to the length of.I string1by duplicating its last character.Any combination of the options.B -cdsmay be used:.TP.B -cComplement.IR string1 :replace it with a lexicographically orderedlist of all other characters..TP.B -dDelete from input all characters in.IR string1 ..TP.B -sSqueeze repeated output characters that occur in.I string2to single characters..PPIn either string a noninitial sequence.BI - x\f1,where .I xis any character (possibly quoted), stands fora range of characters:a possibly empty sequence of codes running fromthe successor of the previous code up throughthe code for.IR x .The character.L \efollowed by 1, 2 or 3 octal digits stands for thecharacter whose16-bitvalue is given by those digits.The character sequence.L \exfollowed by 1, 2, 3, or 4 hexadecimal digits standsfor the character whose16-bit value is given by those digits.A .L \efollowed by any other character standsfor that character..SH EXAMPLESReplace all upper-case.SM ASCIIletters by lower-case..IP.EXtr A-Z a-z <mixed >lower.EE.PPCreate a list of allthe words in.L file1one per line in.LR file2 ,where a word is taken to be a maximal string of alphabetics..I String2is given as a quoted newline..IP.EXtr -cs A-Za-z '\&' <file1 >file2.EE.SH SOURCE.B /appl/cmd/tr.b