tags:

views:

53

answers:

1

I've got CSV data as follows:

1,poster,1,20# Recycled Bond,"4/0, colour master",16.5x23.4",trim
,files in colour attachments COH001 - 2556712,,FSC,,,
8,"Tags (#1-5,7-9)",8,20# Recycled Bond,"4/0, colour master",7x3 ",trim
1,Tags (#6),1,20# Recycled Bond,"4/0, colour master",7x3,trim
,files in colour attachments COH001 - 2556712,,FSC,,,

I want to locate unpaired quotation marks and append a closing quote where there's one missing. For example, line #1 would go from "4/0, colour master",16.5x23.4",trim to "4/0, colour master",16.5x23.4"",trim (notice the extra double quote before ,trim

Any ideas?

A: 

I would do something like that:

s/(,[0-9.x ]*)",/\1'',/

or to make it slightly more universal,

s/((^|,)[0-9.x ]*)"(\s*(,|$))/\1''\3/
Antony Hatchkins
Thanks a million :)
Maximus
You're welcome. )
Antony Hatchkins