lets say I have a file called somedata.txt, I am trying to replace:
\"
with
"
i.e. removing the \ I am trying to do this using AWK. Can you please help?
lets say I have a file called somedata.txt, I am trying to replace:
\"
with
"
i.e. removing the \ I am trying to do this using AWK. Can you please help?
You will need to escape both characters \
and "
like shown below
awk '{gsub("\\\\\"", "\"")}1' somedata.txt
Or if you can use sed
it becomes simpler
sed 's/\\"/"/g' somedata.txt
sed
also allows inplace editing (flag -i
) to update original files
sed -i 's/\\"/"/g' somedata.txt
You can also open file in vim editor and try this: Press esc and then
:%s_oldString_newString_g
For your case, it's
:%s_\\\"_\"_g
Since " and \ are special characters, you need to add a \ before the chars to make the command execute.