[ic] filter existing data

Peter peter at pajamian.dhs.org
Mon Feb 5 20:42:41 EST 2007


On 02/05/2007 03:53 PM, DB wrote:
> I have a gift_note column in my transactions table. I've noticed that if
> customers hit the return key while adding data to this field from the
> checkout form, it screws things up when I export this data as a csv
> file. I've since created a filter for this to strip these "returns":
> 
> CodeDef no_crlf Filter
> CodeDef no_crlf Routine <<EOR
>  sub {
> my $val = shift;
> $val =~ s/[\r\n]+/ /g;
> return $val;
> }
> EOR
> 
> but how can I apply this filter to the existing mysql data which was
> submitted before I had this filter in place?

from the mysql shell:

UPDATE transactions SET comments = REPLACE(comments, '\n', ' ');

Peter



More information about the interchange-users mailing list