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

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

Re: sed ssed bug with the windows binaries


From: Eli Zaretskii
Subject: Re: sed ssed bug with the windows binaries
Date: Sat, 14 Nov 2009 11:20:15 +0200

> Date: Fri, 13 Nov 2009 10:46:22 +0100
> From: Guillaume Frambourg <address@hidden>
> 
> Working sed is :
> --------------------------------------------------------
> sed -e "s/\"//g" test.txt
> --------------------------------------------------------
> 
> it outputs :
> --------------------------------------------------------
> hello
> --------------------------------------------------------
> 
> But if you try :
> --------------------------------------------------------
> sed -e "s/\"//g" test.txt > test2.txt
> --------------------------------------------------------
> 
> it outputs :
> --------------------------------------------------------
> hello
> sed: can't read >: Invalid argument

That's not a problem with Sed, this is a problem with the Windows
shell's too naive handling of quotes.  The Windows shell doesn't
understand the backslash escape, so it thinks the second quote closes
the first one, and the 3rd one quotes everything up to the end of the
command.

The escape character of the Windows shell is `^'.  However, it doesn't
escape inside quoted strings :-(.  So you need to get creative.  For
example:

  sed -e "s/"^""//g" test.txt > test2.txt

This quotes parts of the Sed expression separately, with the literal
quote escaped by `^'.




reply via email to

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