We help IT Professionals succeed at work.
Get Started

perl file merge automation

Vlearns asked
Last Modified: 2012-05-12
Hi Experts,

i need your help with automating the following sequence on unix

I have bunch of directories like the following

ls100_ac2               ls100_hk2               ls100_ne1               ls101_ac2               ls101_mud               ls102_bf1               ls103_gq1               test.pl
ls100_ac4               ls100_in                ls100_sg1               ls101_aue               ls101_ne1               ls102_gq1               ls103_mud               test1.pl
ls100_bf1               ls100_in2               ls100_sk1               ls101_bf1               ls101_sg1               ls102_ird               ls103_ne1
ls100_cnb               ls100_ird               ls100_sp1               ls101_gq1               ls101_sp1               ls102_mud               ls104_mud


or every directory i do the following

1) enter the directory
2) there is file with the a conf extension in that directory with the same name along with a constant prefix. so directory ls100_ac2 has a file called imap_ls100_ac2.conf.  I create a copy of that file so that   cp  imap_ls100_ac2.conf imap_ls100_ac2.conf.bak
3) there is a test.pl in every directory.
4) i concatenate the file with conf extension to the perl file. eg. cat test.pl  imap_ls100_ac2.conf  >test2.pl
5) run test2.pl and overwite the original file. so perl test2.pl >  imap_ls100_ac2.conf
Watch Question
This problem has been solved!
Unlock 2 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE