in reply to substring/regex question
Since your data is in comma separated format, using an absolute offset to extract the number you want doesn't make sense. You can use the Text::CSV module to parse the data into separate fields:
With the 4 data lines you posted, this will create the rgextract.txt file:use Text::CSV; my $file = "trace.csv"; my $file1 = "rgextract.txt"; open my $io, '<', $file or die "$file: $!"; open my $out, '>>', $file1 or die "$file1: $!"; my $csv = Text::CSV->new({ binary => 1, eol => $/ }); while (my $row = $csv->getline ($io)) { my $number = $row->[3]; print $out "$number\n"; }
114 118 114 114
|
|---|