Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Compare and group unmatched records from 2 CSV files together

by Tux (Monsignor)
on Jun 25, 2014 at 12:09 UTC ( #1091181=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Compare and group unmatched records from 2 CSV files together
in thread Compare and group unmatched records from 2 CSV files together

And it will remove \r also when correctly quoted:

code,value 1,"abc\rdef"

Is valid CSV (binary => 1 needed for Text::CSV and Text::CSV_XS), but will change content with that change. Not good!


Enjoy, Have FUN! H.Merijn


Comment on Re^4: Compare and group unmatched records from 2 CSV files together
Select or Download Code
Re^5: Compare and group unmatched records from 2 CSV files together
by Laurent_R (Parson) on Jun 25, 2014 at 17:20 UTC
    Not quite sure to understand what the point is. I just know that I used to have a regex like this:
    s/\r\n/\n/
    or even:
    s/\r\n$/\n/
    but it turned our to insufficient, because the input data sometimes had line ending with "\r\r\n" and sometimes also "\r" in the middle of the line, generating all kinds of probblem. In the end, this regex:
    s/\r//g
    turned out to solve all the problems. Now, of course, it depends on what your input data is and what you need at the end of the day. With different data and different goals, the regex would probably have to be changed. But that's not hot news, if you need to do data munging, the first prerequisite is to know your data well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1091181]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-11-28 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (196 votes), past polls