Spotlight | Reviews | Current Issue | Newsletter | Subscribe | Contact |
Departments

user friendly

  linuxpromagazine.com » Issues » 2005 » 53 » THE TRANSLATOR  

Print this page. Recommend
Slashdot it! Delicious Digg

Using tr and dos2unix

THE TRANSLATOR

Author(s): HEIKE JURZIK

The tr tool is a real wizard. This simple command lets you replace strings in text files. Whether you are replacing letters or just removing whitespace, you will be amazed at tr‘s versatility.

The tr command replaces characters

in text files. The command

reads the standard input and

sends the results to standard output. But

of course, you can use the familiar operators

to redirect both streams. In fact, tr

really shines in combination with other

shell commands.

Simple Replacements

The tr command expects two strings as

arguments and replaces all the occurrences

of the first argument in a text

with the second argument. This may

sound complicated, but let’s look at a

simple example. The following command

replaces the “e“s in “Petronella”

with “a“s:


Read full article as PDF »


Comments


Print this page. Recommend
Slashdot it! Delicious Digg
Live Streaming of LISA '08

22nd Large Installation System Administration Conference

If you follow the fortunes of large installation IT, tune in on November 12-14 for a front row ticket to the Invited Talks series of the USENIX LISA conference.

Find out more

 

In the US and Canada, Linux Magazine is known as Linux Pro Magazine.
Entire contents © 2008 [Linux New Media USA, LLC]
Linux New Media web sites:
North America: [Linux Pro Magazine]
UK/Worldwide: [Linux Magazine]
Germany: [Linux-Magazin] [LinuxUser] [EasyLinux] [Linux-Community] [Linux-Nachrichten] [Linux Events]
Eastern Europe: [Linux Magazine Poland] [Linux Community Poland] [Darmowe Programy Poland] [Open Source DVD Poland] [Linux Magazin Romania]
International: [Linux Magazine Brazil] [Linux Magazine Spanish]
Corporate: [Linux New Media AG]