[EMAIL PROTECTED] wrote:
Hi all,

I have to re-process a delimited file but I only need to proceed records from
the file that satisfy a specific condition. Can someone advise what is the best
way to do this? For example, if I have this file here ....


A~BB~CCC~DDD~EEEE~D~1111
A~BB~CCC~DDD~EEEE~D~2222
A~BB~CCC~DDD~EEEE~U~3333
A~BB~CCC~DDD~EEEE~D~4444
A~BB~CCC~DDD~EEEE~D~5555
A~BB~CCC~DDD~EEEE~U~6666
A~BB~CCC~DDD~EEEE~D~7777
A~BB~CCC~DDD~EEEE~D~8888

This file has already been processed, but somehow records where the 6th column =
D are not processed, so I want to re-run the Perl script but I only want to
process the records for when the 6th column = D.

Any suggestions will be very much appreciated. Thanks in advance.

while (<FILE>) {
  next unless (split /~/)[5] eq 'D';
    :
  process record
}

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to