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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |