<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier,monaco,monospace,sans-serif;font-size:10pt"><div style="font-family: courier,monaco,monospace,sans-serif; font-size: 10pt;">And this one will keep the double quote escape by backslash \". But if a backslash is escaped by a backslash, the double quote following the escaped backslash, this double quote is not escaped, will still be kept.<br><br>Phew ;-& <br><br>'s/(?<![,\\])(?:(^")|")(?![,;]|$)/$1?$1:""/ge?print:print'<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: tiger peng <tigerpeng2001@yahoo.com><br>To: Chicago.pm chatter <chicago-talk@pm.org><br>Sent: Wednesday, October 24, 2007 10:22:22 PM<br>Subject: Re: [Chicago-talk] Removing Characters<br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div
style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">Thanks everyone. Here is the one-liner I am looking for!<br><span style="font-family: courier,monaco,monospace,sans-serif;">perl -ne 's/(?<!,)(?:(^")|")(?!,|$)/defined($1)?$1:""/ge?print:print' in.csv > out.csv</span><br>(-; I have not used my real first name 'Ge' for regex for a while ;-)<br>I believe the replace character and the delimiter can be a set of character, such as<span style="font-family: courier,monaco,monospace,sans-serif;"> ["'] [,:|].<br><br>'s/(?<![,\\])(?:(^")|")(?![,;]|$)/$1?$1:""/ge?print:print'</span></div></div></div><br></div></div></body></html>