User's manual. Section 1.

TREX(1): translate expressions


USAGE

        usage: trex [-Dcfglrstux] to | {from to}
            -D: debug
            -c: translate to capitals (upper case)
            -f: match expressions in full files
            -g: change globally (as many times as can be done per line)
            -l: translate to lower case
            -r: interpret replacements as rune sets
            -s: handle args as strings and not rexps.
            -t: translate to title case
            -u: use unix out
            -x: match against each extracted text (eg., out from gr -x)
        

DESCRIPTION

Trex translates expressions in the input.

When given from and to it translates expressions starting at from and ending at to, for each pair given. Under flag -s both expressions are considered strings, and flag -r makes them behave like in the venerable tr command in UNIX. An empty (but not missing) "to" implies removal of the matched text in this case.

Flags -x and -f are similar to those in gr and are used to preserve matching within data portions as selected by previous gr calls and to perform the matching against the full input text.

There is no flag to delete, just replace with nothing.

EXAMPLES

Translate digits to letters starting at A:

        ; eco A01Z | trex -u -r 0-9 A-x
        AABZ
        

Make a title

        ; eco lord of the rings | trex -ut
        Lord Of The Rings
        

SOURCE

  • /zx/sys/src/clive/cmd/trex


User's manual. Section 1.