Question : Unix Tools: sed Command to Replace Text with TAB Character

Windows XP SP2

I'm trying to execute SourceForge UnixUtils 'sed' command:

    cat file1.txt | sed s/str1/str2/g > file2.txt

However, str2 is the TAB ( \t ) character.  Since sed does not recognize \t as the tab character, but rather interprets it literally as an escaped ' t ' character, I need a way to execute this command.

Please suggest how to execute this command using a script file for the sed command portion.

Answer : Unix Tools: sed Command to Replace Text with TAB Character

Hi,

if you have "sed" you most probably have "tr" as well.

So why not simply

tr "str1" "\t" < file1.txt > file2.txt

?

wmp

Random Solutions  
 
programming4us programming4us