[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suspected bug with gawk sed function and with sed
From: |
Eli Zaretskii |
Subject: |
Re: Suspected bug with gawk sed function and with sed |
Date: |
Sun, 01 Aug 2010 20:04:50 +0300 |
> Date: Sat, 31 Jul 2010 20:56:39 -0400
> From: Robert Greiner <address@hidden>
> Cc: "Greiner, Bob \(Verizon\)" <address@hidden>
>
> 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.
It does for me (also on Windows). I just replaced ? with " leaving
the preceding backslash alone, and it produced the expected results.
The rule is that a literal quote should be preceded by a backslash.
Where did you get these ports of Gawk and Sed?
- Re: Suspected bug with gawk sed function and with sed,
Eli Zaretskii <=