From: Peter Eisengrein [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 7:52 AM
To: AITHA, BHEEMSEN (SBCSI); [EMAIL PROTECTED]
Subject: RE: Create three different files based on search string in the i nput file
A couple questions:- will the "small" file always have the same number of lines?- is there are certain line number on which the match may appear? Or could it be anywhere other than header/footer?- is there a chance that it could match more than one? If so, how do you want to handle it? Only write to the first file? Or write to each file for each match?-----Original Message-----
From: AITHA, BHEEMSEN (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 17:38
To: 'Peter Eisengrein'; [EMAIL PROTECTED]
Subject: Create three different files based on search string in the input fileHi,
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