paulobrads
Programmer
I want to substitute all instances of " symbol in a string with /" symbol, literally.
Code:
gsub(/\"/,"\\\"", $i);
Gives me \\" for each " but I can't find a way of just \"
Any ideas?
Cheers.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
gsub(/\"/,"\\\"", $i);
Like this ?paulobrads said:I want to substitute all instances of " symbol in a string with /" symbol, literally.
[blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"/\"");print}'
1/"+2/"=3/"
[blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"\\\"");print}'
1\"+2\"=3\"