On Tue, Sep 9, 2008 at 2:20 PM, Manoj Srivastava <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>
> tr - TRanslate or Delete characters
>
> Summary:
>
> tr will translate, squeeze, and/or delete characters from stdin,
> writing to stdout. 'tr' supports few standard Esc sequences, regular
> expressions, char classes (lower, upper, space, blank, alpha ...),
> etc.
>
> Examples:
>
> $ echo "tenet" | tr "tn" "TN" -- Translate t to T & n to N.
>
> $ echo "ilugc" | tr "[a-z]" "[A-Z]" -- Change case (lower to upper)
>
> $ echo "ilugc" | tr '[:lower:]' '[:upper:]' -- Same as above.
>
> $ echo "HelloooOOOoooo" | tr -s '[:lower:]' -- Squeeze the "lower"
>                                               case letters.
>
> $ echo "IwLxUyGzC" | tr -d xyz -- Remove xyz
>
> $ cat myfile | tr -s '\n' -- Remove repeated new lines.
>
> $ echo "ABCDEFG" | tr -c "ACEG" "\n" -- Expect "ACEG" translate
>                                        others to newline char.
>
> Read : man tr
>
>        manoj
> --
> Prejudice: A vagrant opinion without visible means of support. Ambrose
> Bierce
> Manoj Srivastava <[EMAIL PROTECTED]> <http://www.debian.org/~srivasta/>
> 1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

My favorite use of tr: rot13
There are better ways to do it, but this is the first that I learned.

$ echo hello world | tr [a-zA-Z] [n-za-mN-ZA-M]
uryyb jbeyq
$ echo uryyb jbeyq | tr [a-zA-Z] [n-za-mN-ZA-M]
hello world

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nlug-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to