I am trying to use this to replace all backslashes with double quotes.
sed -e "s/'\\\\''/\"/g" nomefile
this doesn't do anything.
Input: "prova d\"amico"
Desired output: "prova d""amico"
I am trying to use this to replace all backslashes with double quotes.
sed -e "s/'\\\\''/\"/g" nomefile
this doesn't do anything.
Input: "prova d\"amico"
Desired output: "prova d""amico"
sed -e 's/\\/"/g'
Will replace all /
with "
Your issue is in the first part: \\\''/
, you're looking for '
surrounded /
, but you just need \\
for an escaped \
➜ cat input
"prova d\"amico"
➜
➜ sed -e 's/\\/"/g' input
"prova d""amico"
➜
There's a command specifically for global character substitutions ("transliterations"), y
:
sed 'y/\\/"/'
where \
has to be escaped with another \
.