Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Compare 2 CSV files by two different column and printout

by sundialsvc4 (Abbot)
on Oct 01, 2013 at 14:19 UTC ( #1056488=note: print w/replies, xml ) Need Help??

in reply to Compare 2 CSV files by two different column and printout

If you are dealing with six thousand lines, of about this size, and know that it will never become larger, then you can probably be quite brute-force about your approach and it will work just fine.   Read the lines from file #1 into an array, then use, say, the grep() function to search for a regular expression such as ^$hostname\: ... thus looking for “starting at the beginning of the line, look for $hostname followed by a colon-character.”   Use split() to split-up the lines as needed.   There are several equally-good ways to do this.

Also consider the possibility of using Unix command-line tools such as grep, egrep, sort, merge, and especially diff.   Sometimes, you discover that you don’t have to “write a program” at all!

While we don’t offer a program-writing service or homework-service, it certainly is possible to “try sincerely to write it” and then to ask us for specific help.

  • Comment on Re: Compare 2 CSV files by two different column and printout

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056488]
[robby_dobby]: LA: That's there. But this is work and it's the same thing as falling asleep driving :-)
[Lady_Aleena]: I love the dream where I was at a huge house and decided to go swimming in the pool, but then the tour group showed up.
choroba fell asleep while driving half a year ago
[choroba]: fortunately, only the traffic sign and the car were damaged
[Discipulus]: fall asleep? coffee time!
Discipulus when in motorbike it is impossible to fall asleep.. another advantage

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2017-05-29 08:10 GMT
Find Nodes?
    Voting Booth?