I'm attempting to convert a mysqldump output file to PostgreSQL compatible SQL. The issue is in dealing with escaped string values.
I need to go from:
VALUES('blah blah blah','second string \'with escaped\'
quotes
and multiple lines goes here',35,10,'meh')
to:
VALUES(E'blah blah blah',E'second string \'with escaped\'
quotes
and multiple lines goes here',35,10,E'meh')
Notice the addition of the "E" before each single-quoted string.
How can this be accomplished in sed? Also open to using other regex engines as long as I can stream them (dealing with multi-GB files here).
It occurred to me that this is not an uncommon usage scenario, so I checked PostgreSQL's site to see if they have solutions -- and indeed they list several tools to do the job. Hopefully one of them works for you.