| Raw Input
| This one, not \, "keep this, \" this, but" replace, one
"Keep, replace", replace, keep \, and "this, that, final"
|
|
| Desired Output
| This one# not \, "keep this, \" this, but" replace# one
"Keep, replace"# replace# keep \, and "this, that, final"
|
|
Script and Comments
Script1 [sed] [ 1] :loop
[ 2] s/^(([^"\\,]|"([^\\"]|\\.)*"|\\.)*),/\1#/
[ 3] t loop
| |
Script2 [perl] [ 1] s/\G((?:[^"\\,]|"(?:[^\\"]|\\.)*"|\\.)*),/$1#/g
| |
|