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.