I have this test.sql file:
'here' and ' You want to change 'Other' for and \ ' (avoiding a quote) ' ' (2 singles) With quotes) for postgres and leave other single quotes alone. How would I do this. I have tried:
mn march 16 $ sed -i.bak s / \ '/' '/ g test.sql but it's out All single quotes take
Your enemy shuttle is cited in this. The string is
s / \ '/' '/ g before giving it to SAL. For shell, '' is an empty string, and suppresses this particular meaning of single citations (so that the quote is a real single quote character). What is seen after processing
s / '// g ... which removes all single quotes.
There are several ways to work around the problem; One of them is
sed -i.bak "s / \\\\ '/' '/ g" test.sql Double inside - Small shell string, backslash need to be avoided (exceptions exist). This means that the translation of "s / \\\\ '/' '/ g" in the shell command as s / \\' / '' / g Logic is SED In Sam Rigax, backslash also needs to run, so it's really what we wanted to do: all the examples of \ ' would be replaced by ' ' .
No comments:
Post a Comment