Title: RE: [Perl-unix-users] search for a particular string in a file

Hi,

I have a small file. I want to read this file and create three different files based on a string found.

For example my small file is like this.

 

this is the header line

this too is header line

----

---

search strings are here abc xyz mlt

some more are here pqr jkl

some more are asd frg supp

----

---

this is footer

this is also footer...

 

Now the three different output files  should contain all the header and footer lines. But if "abc" or "xyz" or "mlt" is found on a line it should go to out file A only, if string "pqr" or "jkl" is found it should go to output file B only and if string "frg" or "supp" is found on a line it should go to out put file C only.

 

Can any one help me on how to do this easily using perl code.

 

Note: I am new to PERL.

 

Thanx..

-Bheemsen

Reply via email to