Skip to main content
2 of 3
added 8 characters in body; edited tags
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

Replace only certain double quotes in data file

We extract data from a database to a flat file, we use a pipe for column delimiter and double quotes for text delimiter.

Data file looks Something like this:

“164829” | “collection 1” | “wood plank 2” x 4” long” | “23.5” 

What command/script could find every case where the data (not including the text delimiter) can be escaped with a second double quote?

The end result should look like this:

“164829” | “collection 1” | “wood plank 2”” x 4”” long” | “23.5”