Hi, I am a Perl rookie. I have two .csv files example of csvfile1:
ausdny3-01.bsn.savvis.net:,sid:s213882:ausdny3_01-2:0:152,access,ATM-V +C,6,1,0,152,Up ausdny3-01.bsn.savvis.net:,sid:zzwenz:ausdny3_01-2:0:132,access,ATM-VC +,6,1,0,132,Up ausdny3-01.bsn.savvis.net:,sid:s224384:ausdny3_01-2:0:172,access,ATM-V +C,6,1,0,172,Up ausdny3-01.bsn.savvis.net:,sid:taicap:ausdny3_01-2:0:129,access,ATM-VC +,6,1,0,129,Up
example of csvfile2:
savvis:ausdny3_01.bsn:usstls6_01_mgmt-pri.bln:00:bsntrunk,09.01:ausdny +3_01.bsn_06.01,ausdny3_01.bsn,6,1,0,100 savvis:ausdny3_01.bsn:sgsing1_01.bsn:14:bsntrunk,09.01:ausdny3_01.bsn_ +06.01,ausdny3_01.bsn,6,1,0,41 savvis:ausdny3_01.bsn:sgsing1_01.bsn:20:bsntrunk,09.01:ausdny3_01.bsn_ +06.01,ausdny3_01.bsn,6,1,4,77 savvis:ausdny3_01.bsn:sgsing1_01.bsn:13:bsntrunk,09.01:ausdny3_01.bsn_ +06.01,ausdny3_01.bsn,6,1,0,50
I need an output of two different things, the first being a file containing CLOSE matches of csvfile1(fields 1,4,5,6,7)with csvfile2(fields 2,3,4,5,6) AND an output of what DIDNT match. So far, I have this code based on something I found here on Perlmonks:
#!/usr/bin/perl open(I1,"Shasta-Naviscore-Audit.csv") or die "file1: $!"; while (<I1>) { # get data chomp; my ($sshastaname,$ssubname,$stype1,$stype2,$sslot,$sport,$svpi,$sv +ci) = split /,/; @SHASTA = ($sshastaname,$sslot,$ssport,$svpi,$svci); } open(I2,"Naviscore-Shasta-Audit.csv") or die "file2: $!"; while (<I2>) { # get data chomp; my ($npvcname,$nslportname,$nshasta,$nslot,$nport,$nvpi,$nvci) = s +plit /,/; @NAVIS = ($nshasta,$nslot,$nport,$nvpi,$nvci); }

In reply to Comparing fields of two CSV files by tgrossner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.