Personal tools

Tr

From MohidWiki

Revision as of 17:39, 9 January 2008 by 192.168.20.177 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tr is a little linux utility which translates standard input and returns in standard output. It is useful for easily converting from uppercase to lowercase, etc...

Examples

>for i in `find | grep Nomfich`; do j=`echo $i | tr [Nom] [nom]`; if [ $i != $j ]; then mv $i $j; fi; done;

This bash line transforms the Nomfich_*.dat files into nomfich_*.dat

> cat somefile.txt | tr -cd [:graph:]

This line deletes all non-printable characters (good for chomping a string...)