Dear All,
In the attached file, the date is present in the last line. My requirement is to capture the date and fill it in the date field from the line 1. after capturing the date through regular expression I am using seek(FH,0,0) to goto the beginning of the file. But it has no effect.
My code is like this.
while($line=<FH>) { if($line=~m/Printed on Sat ([a-z]{3}\s*\d{1,2}\s*\d{4})/i) { $date=$1; } seek(FH,0,0) $line=~s/\|\d{3}.................$date.............; }
But this code is not giving the required result. Please help me in solving this problem.
Regards, Ganesh
Page 1 of 1 ================================================================================ |Job |BBB | Filename | Bytes | ISP | MRW | MRL |MRP |ISC |MSC |PFR |Date |Time | ================================================================================ |990 |118A| 0000115 | 8038 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000285 | 91245 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000485 | 18168 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000597 | 10531 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000613 | 14031 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000805 | 7235 | | | | | | | | | | -------------------------------------------------------------------------------- |990 |118A| 0000813 | 7188 | | | | | | | | | | -------------------------------------------------------------------------------- ================================================================================
Printed on Sat Apr 30 2005 13:14:57
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>