Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
"be consistent"
 
PerlMonks  

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

by sundialsvc4 (Monsignor)
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-04-18 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (461 votes), past polls