9base

revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log | Files | Refs | README | LICENSE

tr.1 (1729B)


      1 .TH TR 1
      2 .SH NAME
      3 tr \- translate characters
      4 .SH SYNOPSIS
      5 .B tr
      6 [
      7 .B -cds
      8 ]
      9 [
     10 .I string1
     11 [
     12 .I string2
     13 ]
     14 ]
     15 .SH DESCRIPTION
     16 .I Tr
     17 copies the standard input to the standard output with
     18 substitution or deletion of selected characters (runes).
     19 Input characters found in
     20 .I string1
     21 are mapped into the corresponding characters of
     22 .IR string2 .
     23 When
     24 .I string2
     25 is short it is padded to the length of
     26 .I string1
     27 by duplicating its last character.
     28 Any combination of the options
     29 .B -cds
     30 may be used:
     31 .TP
     32 .B -c
     33 Complement
     34 .IR string1 :
     35 replace it with a lexicographically ordered
     36 list of all other characters.
     37 .TP
     38 .B -d
     39 Delete from input all characters in
     40 .IR string1 .
     41 .TP
     42 .B -s
     43 Squeeze repeated output characters that occur in
     44 .I string2
     45 to single characters.
     46 .PP
     47 In either string a noninitial sequence
     48 .BI - x\f1,
     49 where 
     50 .I x
     51 is any character (possibly quoted), stands for
     52 a range of characters:
     53 a possibly empty sequence of codes running from
     54 the successor of the previous code up through
     55 the code for
     56 .IR x .
     57 The character
     58 .L \e
     59 followed by 1, 2 or 3 octal digits stands for the
     60 character whose
     61 16-bit
     62 value is given by those digits.
     63 The character sequence
     64 .L \ex
     65 followed by 1, 2, 3, or 4 hexadecimal digits stands
     66 for the character whose
     67 16-bit value is given by those digits.
     68 A 
     69 .L \e
     70 followed by any other character stands
     71 for that character.
     72 .SH EXAMPLES
     73 Replace all upper-case
     74 .SM ASCII
     75 letters by lower-case.
     76 .IP
     77 .EX
     78 tr A-Z a-z <mixed >lower
     79 .EE
     80 .PP
     81 Create a list of all
     82 the words in
     83 .L file1
     84 one per line in
     85 .LR file2 ,
     86 where a word is taken to be a maximal string of alphabetics.
     87 .I String2
     88 is given as a quoted newline.
     89 .IP
     90 .EX
     91 tr -cs A-Za-z '
     92 \&' <file1 >file2
     93 .EE
     94 .SH SOURCE
     95 .B \*9/src/cmd/tr.c
     96 .SH "SEE ALSO"
     97 .IR sed (1)