bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suspected bug with gawk sed function and with sed


From: Robert Greiner
Subject: Suspected bug with gawk sed function and with sed
Date: Sat, 31 Jul 2010 20:56:39 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.7) Gecko/20100713 Lightning/1.0b2 Thunderbird/3.1.1

I love your Windows version of Unix utilities, but I have run into an
intractable problem: how do you substitute a given character with a
literal double quote? I have tried both gawk's sub function as well as
sed, but I cannot get either to work.

For example, if I substitute a leading question mark with some innocuous
character like a 3 or a 7, the following two commands both work fine:


     gawk "{ if ($0 ~ /^\?/) sub (/\?/, "3", $0); print $0 }" junkin.txt
> junkout.txt

     sed "s/^\?/7/" junkin.txt > junkout.txt

However, if I change the 3 or 7 into a double quote, even with one or
more backslash escape characters, neither command works, at least not in
the Windows implementation.

In both examples, I also tried changing the outer double quotes into
single quotes to avoid confusion with the double quote I wanted to use
as the substitute character, but that failed, too.

Is there any way to change a specified character into a double quote
character? What am I doing wrong (or failing to do)?

Thanks in advance.

Robert Greiner
Chesterfield, Virginia (USA)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]