in reply to Clean data - where field contains a CRLF
The bottom bit was just to prove it worked and print out new clean records. I need to do some addtional error checking but this produces a clean file.#!/usr/bin/perl use strict; my @chunks; { local $/ = undef; @chunks = split(/^(?=(?:EN))/m, <>); } print "Rec: ",scalar(@chunks), " eor\n"; for (my $i=0; $i <= scalar(@chunks); $i++) { $chunks[$i] =~ s/[\r\n]+//g; if ($chunks[$i] =~ /^EN/ ) { print "$chunks[$i]\n"; } }
Any ideas for improvement?
sxmwb
|
|---|