Hi,

I am brand new on Perl
Learning slowly though
I will appreciate someone's help on this 
I wrote a small script with someone's help
The script opens up two text files and goes thru it line by line 
They both are in same format. firstfile has all the entries the secondfile
has some lines or entries missing.
The script compares firstfile with secondfile and then spits out the whole
line which is missing in the secondfile
Instead of spiting the whole line I want the script to tell me the name of
one specific string from the line, not the whole line
I tried but was unable to do it correctly. 
Later I changed the firstfile entirely so that it has only one column of the
names I am looking for in the secondfile but it did not work since it
spitted all the names from the firstfile.
I am attaching both firstfile and second file 
What I need is instead of comparing with firstfile I want it to compare it
to thirdfile which only has names in one column

In short I want the script to compare thirdfile (this has all entries in one
column) with secondfile and spits me what it did not find in secondfile.
If someone can help me please

 <<firstfile.txt>>  <<secondfile.txt>>  <<Thirdfile.txt>> 
Thanks
Junaid

use Win32;
use Net::SMTP;

my($input1, $input2);           # Defining txt files 

# First file
$input1 = "./secondfile.txt"; # List of Svcs currently running

#second file
$input2 = "./firstfile.txt";  # List of All Svcs which should be running

my(@arr1, @arr2, @result);  # Defining arrays

my($match, $cnt, $currentval1, $currentval2, $resultarraysize); # Defining
scalar variables
$match = "N"; 

#Open first file and insert every line into @arr1
open(INPUT, $input1) or die "Unable to open $input1.";   # Open the txt file
and place it filehandle           

$cnt = 0;
while ( <INPUT> ) # Looping thru the file
 {
        $arr1[$cnt] = $_;
        $cnt = $cnt + 1;
  } 
  close (INPUT);

#Open second file and insert every line into @arr2
open(INPUT, $input2) or die "Unable to open $input2.";    # Open the txt
file and place it filehandle                      

$cnt = 0;
while ( <INPUT> ) # Looping thru the file
{
        $arr2[$cnt] = $_;
        $cnt = $cnt + 1;
  } 
  close (INPUT);

# Outer loop is for second file (firstfile)
# Inner loop is for first file (secondfile)
# Taking one element from @arr2 and comparing it with all the elements in
@arr1 and 
# If their is no match then insert it into final result array.

$cnt = 0;
foreach $currentval2 (@arr2) 
{
        foreach $currentval1 (@arr1)
        {
                if ($currentval1 eq $currentval2) 
                {
                        $match = "Y";
                }
        }
        if  ($match eq "N") 
        {
                $result[$cnt] = $currentval2;
                $cnt = $cnt + 1;
        }

        $match = "N";
        }

$resultarraysize = 0;
foreach $currentval1 (@result)
{
        $resultarraysize = $resultarraysize + 1;
}

if ($resultarraysize >  0 ) 
{
        print "\nFollowing services are not Functioning\n\n"; # If some svc
is not functioning
        foreach $currentval1 (@result)
        {
                print "$currentval1";

        }
}
else
{
        print "\nAll Services are Functioning Fine\n"; # When all svcs are
running fine when there is no difference between
# both files
}

S1_NXLKINT|SMECacheMgr|Analysis Cache Manager|SMECacheMgr|Dead|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMEProxyMgr|Analysis Proxy Manager|SMEProxyMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMEQueryMgr|Analysis Query Manager|SMEQueryMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|AsgnSrvr|Assignment Manager|AsgnSrvr|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|AsgnBatch|Batch Assignment|AsgnBatch|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|CTIRoute|CTI Inbound Call Router|CTIRoute|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|Dqmgr|Data Quality Manager|Dqmgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|DbXtract|Database Extract|DbXtract|Enabled|Running|06/11/2001 
17:30:40|10|0|1|
S1_NXLKINT|MailAgent|E-mail Agent|MailAgent|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|MailMgr|E-mail Manager|MailMgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|EIM|Enterprise Integration Mgr|EIM|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
S1_NXLKINT|FSCyccnt|Field Service Cycle 
Counting|FSCyccnt|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|FSRepl|Field Service Replenishment E|FSRepl|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|GenNewDb|Generate New Database|GenNewDb|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|GenTrig|Generate Triggers|GenTrig|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|ICMCalcEngine|ICM Calc Engine|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICMCalcImport|ICM CalcWkbk Import|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICMOrderImport|ICM Order Import|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICompMgr|Incentive Compensation Mgr|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ListMgr|List Manager|ListMgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|ObjMgr|Object Manager|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|PageMgr|Page Manager|PageMgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|RTISrvr|Real-Time Integration 
Manager|RTISrvr|Unavailable|Running|06/11/2001 17:30:40|2|0|1|1|0|0|
S1_NXLKINT|RepAgent|Replication Agent|RepAgent|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|SAPBAPIProcessor|SAP BAPI Processor|RTIBatch|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SAPProcessor|SAP IDOC Processor|EAI|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SAPReceiver|SAP IDOC Receiver|EAI|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMECampMgr|SME Campaign Manager|SMECampMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMECellSvr|SME Cell Server|SMECellSvr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMESgmntSvr|SME Segment Server|SMESgmntSvr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|ServerMgr|Server Manager|ServerMgr|Running|Running|06/11/2001 
17:30:40|20|3|1|
S1_NXLKINT|SRMSynch|Server Request Manager|SRMSynch|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|ReqProc|Server Request Processor|ReqProc|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|FSFulfill|Service Order Fulfillment 
Eng|FSFulfill|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|FSLocate|Service Order Part Locator 
En|FSLocate|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|SCCObjMgr|Siebel Call Center|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SFSObjMgr|Siebel Field Service|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SSEObjMgr|Siebel Sales Enterprise|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SSVObjMgr|Siebel Service Enterprise|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|eChannelObjMgr|Siebel eChannel|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|eServiceObjMgr|Siebel eService|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SynchMgr|Synchronization Manager|SynchMgr|Unavailable|Running|06/11/2001 
17:30:40|100|0|1|1|0|0|
S1_NXLKINT|TxnMerge|Transaction Merger|TxnMerge|Running|Running|06/11/2001 
17:30:40|10|1|1|
S1_NXLKINT|TxnProc|Transaction Processor|TxnProc|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|TxnRoute|Transaction Router|TxnRoute|Enabled|Running|06/11/2001 
17:30:40|10|0|1|
S1_NXLKINT|VitriaWorkMon|Vitria Workflow|WorkMon|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|WorkActn|Workflow Action Agent|WorkActn|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
S1_NXLKINT|WorkMon|Workflow Monitor Agent|WorkMon|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
48 rows returned.|

S1_NXLKINT|SMEProxyMgr|Analysis Proxy Manager|SMEProxyMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMEQueryMgr|Analysis Query Manager|SMEQueryMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|AsgnSrvr|Assignment Manager|AsgnSrvr|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|AsgnBatch|Batch Assignment|AsgnBatch|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|CTIRoute|CTI Inbound Call Router|CTIRoute|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|Dqmgr|Data Quality Manager|Dqmgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|

S1_NXLKINT|MailAgent|E-mail Agent|MailAgent|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|EIM|Enterprise Integration Mgr|EIM|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
S1_NXLKINT|FSCyccnt|Field Service Cycle 
Counting|FSCyccnt|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|FSRepl|Field Service Replenishment E|FSRepl|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|GenNewDb|Generate New Database|GenNewDb|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|GenTrig|Generate Triggers|GenTrig|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|ICMCalcEngine|ICM Calc Engine|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICMCalcImport|ICM CalcWkbk Import|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICMOrderImport|ICM Order Import|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ICompMgr|Incentive Compensation Mgr|ICompMgr|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|ListMgr|List Manager|ListMgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|ObjMgr|Object Manager|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|PageMgr|Page Manager|PageMgr|Enabled|Running|06/11/2001 17:30:40|20|0|1|
S1_NXLKINT|RTISrvr|Real-Time Integration 
Manager|RTISrvr|Unavailable|Running|06/11/2001 17:30:40|2|0|1|1|0|0|
S1_NXLKINT|SAPBAPIProcessor|SAP BAPI Processor|RTIBatch|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SAPProcessor|SAP IDOC Processor|EAI|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SAPReceiver|SAP IDOC Receiver|EAI|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMECampMgr|SME Campaign Manager|SMECampMgr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMECellSvr|SME Cell Server|SMECellSvr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|SMESgmntSvr|SME Segment Server|SMESgmntSvr|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|ServerMgr|Server Manager|ServerMgr|Running|Running|06/11/2001 
17:30:40|20|3|1|
S1_NXLKINT|SRMSynch|Server Request Manager|SRMSynch|Unavailable|Running|06/11/2001 
17:30:40|20|0|1|1|0|0|
S1_NXLKINT|ReqProc|Server Request Processor|ReqProc|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|FSFulfill|Service Order Fulfillment 
Eng|FSFulfill|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|FSLocate|Service Order Part Locator 
En|FSLocate|Unavailable|Running|06/11/2001 17:30:40|20|0|1|1|0|0|
S1_NXLKINT|SCCObjMgr|Siebel Call Center|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SFSObjMgr|Siebel Field Service|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SSEObjMgr|Siebel Sales Enterprise|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SSVObjMgr|Siebel Service Enterprise|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|eChannelObjMgr|Siebel eChannel|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|eServiceObjMgr|Siebel eService|ObjMgr|Running|Running|06/11/2001 
17:30:40|20|0|1|1|1|1|
S1_NXLKINT|SynchMgr|Synchronization Manager|SynchMgr|Unavailable|Running|06/11/2001 
17:30:40|100|0|1|1|0|0|
S1_NXLKINT|TxnMerge|Transaction Merger|TxnMerge|Running|Running|06/11/2001 
17:30:40|10|1|1|
S1_NXLKINT|TxnProc|Transaction Processor|TxnProc|Enabled|Running|06/11/2001 
17:30:40|1|0|1|
S1_NXLKINT|TxnRoute|Transaction Router|TxnRoute|Enabled|Running|06/11/2001 
17:30:40|10|0|1|
S1_NXLKINT|VitriaWorkMon|Vitria Workflow|WorkMon|Enabled|Running|06/11/2001 
17:30:40|20|0|1|
S1_NXLKINT|WorkActn|Workflow Action Agent|WorkActn|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
S1_NXLKINT|WorkMon|Workflow Monitor Agent|WorkMon|Enabled|Running|06/11/2001 
17:30:40|5|0|1|
48 rows returned.|
SMECacheMgr                       
SMEProxyMgr                       
SMEQueryMgr
AsgnSrvr
AsgnBatch
CTIRoute
Dqmgr
DbXtract
MailAgent
0MailMgr
EIM
FSCyccnt
FSRepl
GenNewDb
GenTrig
ICMCalcEngine
ICMCalcImport
ICMOrderImport
ICompMgr
ListMgr
ObjMgr
PageMgr
RTISrvr
RepAgent
SAPBAPIProcessor
SAPProcessor
SAPReceiver
SMECampMgr
SMECellSvr
SMESgmntSvr
ServerMgr
SRMSynch
ReqProc
FSFulfill
FSLocate
SCCObjMgr
SFSObjMgr
SSEObjMgr
SSVObjMgr
eChannelObjMgr
eServiceObjMgr
SynchMgr
TxnMerge
TxnProc
TxnRoute
VitriaWorkMon
WorkActn
WorkMon

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to