Perhaps this is what you want:
sed "s/\([0-9]\)\"\([^;]\)/\1''\2/g"
Ie: Find the double quotes ( " ) after the number ( [0-9] ), but do not follow the semicolon ( [^;] ) and replace it with two single quotes.
Edit: I can expand my team (now it is getting quite long):
sed "s/\([0-9]\)\"\([^;]\)/\1''\2/g;s/\([^;]\)\"\([^;]\)/\1\'\2/g;s/\([^;]\)\"\([^;]\)/\1\'\2/g"
How do you use SunOS, I think you cannot use extended regular expressions ( sed -r )? So I did it like this: the first s command replaces all inches with " ,” the second and third s match. They replace all " that are not a direct neighbor of a ; with one. ' I have to do this twice to be able to replace the second " , for example. "L" , because there is only one character between " , and this character already matches \([^;]\) . Thus, you also replace "" with '' . If you have """ or """" etc., you need to put one more (but one more) s .
source share