Guillaume Frambourg
2009-11-13 09:46:22 UTC
Hi,
When you try to replace " with some character that is not escaped, it works.
But it won't accept to save the output in another file.
ie :
test.txt contains
"hello"
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
--------------------------------------------------------
Also trying :
--------------------------------------------------------
sed -e "s/\"/\"test/g" test.txt > test2.txt
--------------------------------------------------------
it outputs "testhello"test into test2.txt
So using an escaped character in search string but not in replacestring
breaks the command line interpretation.
Thanks
When you try to replace " with some character that is not escaped, it works.
But it won't accept to save the output in another file.
ie :
test.txt contains
"hello"
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
--------------------------------------------------------
Also trying :
--------------------------------------------------------
sed -e "s/\"/\"test/g" test.txt > test2.txt
--------------------------------------------------------
it outputs "testhello"test into test2.txt
So using an escaped character in search string but not in replacestring
breaks the command line interpretation.
Thanks