troubleshooting Question

Help with parsing two files

Avatar of anshuma
anshumaFlag for United States of America asked on
Perl
3 Comments1 Solution47 ViewsLast Modified:
Hi,

I have two files

file1 and file2

file1 contains
----------------------------------------------------------------------------------------
else if (Headers[i].indexOf(strAverepQueueTime)!= -1)
                          {

                            $name = i;

                          }

else if (Headers[i].indexOf(strExecutingreps)!= -1)
                          {

                            $name = i;

                          }

else if (Headers[i].indexOf(strrepsCompRate)!= -1)
                          {

                            $name = i;

                          }

else if (Headers[i].indexOf(strtotCompletedreps)!= -1)
                          {

                            $name = i;

                          }

............................................
............................................
............................................


file2 contains
--------------------------------------------------
AverepQueueTimeindex
Executingrepsindex
repsCompRateindex
totCompletedrepsindex
............................................
............................................
............................................



so what I need to do is replace each $name in file1 by consecutive string in file2

so the final output should look like

else if (Headers[i].indexOf(strAverepQueueTime)!= -1)
                          {

                           AverepQueueTimeindex = i;

                          }

else if (Headers[i].indexOf(strExecutingreps)!= -1)
                          {

                            Executingrepsindex = i;

                          }

else if (Headers[i].indexOf(strrepsCompRate)!= -1)
                          {

                            repsCompRateindex= i;

                          }

else if (Headers[i].indexOf(strtotCompletedreps)!= -1)
                          {

                            totCompletedrepsindex= i;

                          }

Hope this helps. Please let me know if there are any further questions.





ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros