Sep 1, 2008 #1 paulobrads Programmer Joined Jul 13, 2006 Messages 28 Location GB 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.
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.
Sep 1, 2008 1 #2 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi paulobrads said: I want to substitute all instances of " symbol in a string with /" symbol, literally. Click to expand... Like this ? Code: [blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"/\"");print}' 1/"+2/"=3/" Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi paulobrads said: I want to substitute all instances of " symbol in a string with /" symbol, literally. Click to expand... Like this ? Code: [blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"/\"");print}' 1/"+2/"=3/" Feherke. http://rootshell.be/~feherke/
Sep 1, 2008 Thread starter #3 paulobrads Programmer Joined Jul 13, 2006 Messages 28 Location GB Afraid not, that slash is the wrong way round, I want to actually insert an escape character - \ Upvote 0 Downvote
Sep 1, 2008 #4 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Then this ? Code: [blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"\\\"");print}' 1\"+2\"=3\" Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Then this ? Code: [blue]master #[/blue] echo '1"+2"=3"' | awk '{gsub(/"/,"\\\"");print}' 1\"+2\"=3\" Feherke. http://rootshell.be/~feherke/
Sep 1, 2008 Thread starter #5 paulobrads Programmer Joined Jul 13, 2006 Messages 28 Location GB That's the beast. Cheers. Upvote 0 Downvote