i have a master csv file and a daily csv file, i need to compare email server addresses in the daily file against the addresses in master file and print a list of any that are not on the master sheet, the problem is i only need to compare up to the 1st fullstop, ie as long as the first part of the address matches thats ok it does not matter whats after the fullstop. however if there is no match the whole address needs to be displayed on screen.

<p> INPUT john.co.uk,Acton,Backup,Team,backup,bkup-01,External gim.com,Acton,Backup Team,backup,bumas1,internal jeff.be.com,Acton,Backup Team,backup,bumas1,internal scream,Acton,Backup Team,backup,bumas1,internal ACTDFVUA.co.uk,Acton,Backup Team,backup,imrn,internal <c> <p> INPUT1 Server,Type,Reason,Data at Risk,Ticket,Resolution john.com,F,No email received,YES gim,Acton,Backup Team,backup,bumas1,internal elephant.com,F,No email received,YES jeff.co.com,F,No email received,YES scream,S,1 email received,Some banana,F,No email received,YES

result would be print "elephant.com NOT KNOWN PLEASE UPDATE " print "banana NOT KNOWN PLEASE UPDATE " </c>

this is what i use at present

open (INPUT1,"$INFILE1") or die " cannot open $INFILE1"; while (<INPUT1>) { @INFILE = ($_); chomp($_); @FAILS = split (/,/,); @SERVER = splice (@FAILS,0,1); @TYPE = splice (@FAILS,0,1); @REASON = splice (@FAILS,0,1); @STATUS = splice (@FAILS,0,1); @TICKET = splice (@FAILS,0,1); @RESOLUTION = splice (@FAILS,0,1); foreach $server1 (@SERVER) { $servers = $server1; $servers =~ tr/[a-z]/[A-Z]/; } foreach $type1 (@TYPE) { $types = $type1; $types =~ tr/[a-z]/[A-Z]/; } if ( "$types" eq "F") { $types="BACKUP FAILED"; } else { if ("$types" eq "S") { $types="SKIPPED FILES"; @TICKET="DO NOT RAISE TICKET"; }} $value= &read_location; if ("$value" ne "0"){ print "@SERVER NOT KNOWN PLEASE UPDATE \n"; } } sub read_location { open (INPUT,"$INFILE") or die " cannot open $INFILE "; while (<INPUT>) { $result = 1; chomp($_); @array = ($_); @all = split (/,/,); @machine = splice (@all,0,1); @loc = splice (@all,0,1); @team = splice (@all,0,1); @software = splice (@all,0,1); @backup_server = splice (@all,0,1); @owner = splice (@all,0,1); foreach $machine1 (@machine) { $machines = $machine1; $machines =~ tr/[a-z]/[A-Z]/; } if ("$servers" eq "$machines"){ printf OUTPUT ("%s %s %s,%s,%s,%s,%s,%s,%s,%s,%s,%s, \n",$ +todaysday,$thismonth,$year,@loc,@team,@owner,$servers,$types,@REASON, +@STATUS,@TICKET,@RESOLUTION, ); close (INPUT); return 0; } } } close (INPUT); close (OUTPUT);

In reply to compare csv files only to first fullstop character by john.tm

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.