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 »
|
Special Linux Magazine 3 for 1 Offer
|
|---|
|
Get 3 Issues + 3 DVDs for the price of a single issue!
Let Linux Magazine's hands-on, technical articles guide you in your daily Linux use. Check out bonus DVDs like Ubuntu, SUSE, or Fedora and save the download.
Only available for a limited time. Don't miss out!
more...
|
|
Comments