Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
1. The input file is abc.txt
2. Check file for TL header records (adds, deletes, modifies) identified by "HA", "HD" and "HM".
2a) Check Art file for the LTL header records (adds, deletes,modifies) identified by "SA" , "SD" and "SM".
3. For Adds, ("HA", "SA"), catch email value.(It should be in between "P" records (order R, O, I and P).
4. For Modifications, ("HM", "SM"), catch email value.(It should be in between "P" records (order R, O, I and P).
I would like to catch email address values before HATL or SALTL or HMTL or SMLTL or HDTL or SDLTL line starts...
I started writing like this ...
Please try to provide a soln... Thanks#!/usr/bin/perl open SEE ,"c:/abc.txt"; @ok=<SEE>; close(SEE); foreach(@ok) { if($_ =~ /HATL/) { ($o,$t) = split(/\s+/, $_); print "second value $t<br>"; ### I would like to catch email address values before HATL or SALTL li +ne starts... ### How can i do that? } if($_ =~ /SALTL/) { ($o,$t) = split(/\s+/, $_); print "second value $t<br>"; } }
update (broquaint): added formatting + dropped customer data sample
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: catch values from txt file
by Tomte (Priest) on Jun 23, 2003 at 10:12 UTC | |
|
Re: catch values from txt file
by BrowserUk (Patriarch) on Jun 23, 2003 at 14:58 UTC |