in reply to Re: Clean data - where field contains a CRLF
in thread Clean data - where field contains a CRLF
According to the perl docs I've seen, chomp "removes any trailing string that corresponds to the current value of $/".# s/\r//g; # chomp; # expressed better (less platform dependent) as: s/[\r\n]+//g; # or, to be compulsive, use the numerics: s/[\x0a\x0d]+//g;
If perl has $/ set to "\r\n", taking away the "\r" before chomping might cause the chomp to do nothing at all. (But I'm not a windows user, so I could be wrong about that.)
Also, depending on the data and the task, it might make more sense to replace every [\r\n]+ with a space, rather than an empty string, esp. if consecutive lines will be concatenated into a single string.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Clean data - where field contains a CRLF
by GrandFather (Saint) on Aug 21, 2006 at 02:37 UTC |