In a private message, sonicscott9041 said he needs to produce a CSV file and pointed out that there are multiple sets of data on a page.
After reviewing the data a little more attentively, there are obvious sets of records separated by blank lines, with page brakes interrupting these.
Here is a simple approach to producing CSV output. It is based on the original report but the matches for start and end values for each record set can easily be changed to accommodate the new report.
use strict; use warnings; my $file = '782426.pl'; open(my $fh, '<', $file) or die "$file: $!"; my $csv; foreach my $line (<$fh>) { chomp($line); next unless($line =~ m/^([^\.]+)\.+\s+(.*)/); if($1 eq 'STOCK NO') { $csv = $2; } $csv .= ",$2"; print "$csv\n" if($1 eq 'SALES CST'); } close($fh);
In reply to Re^3: Text Extraction
by ig
in thread Text Extraction
by sonicscott9041
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |