in reply to Re^6: raw data formatting
in thread raw data formatting
A grep on the data to check for four spaces followed by a digit at the beginning of each line works:
use strict; use warnings; use List::MoreUtils qw/natatime/; my $it = natatime 5, grep /\A\s{4}\d/, <DATA>; while ( chomp( my @lines = $it->() ) ) { my $letter = 'A'; my $acctNum = do { $lines[0] =~ /\s+(\d+)\s+(\d+)/; $1 . $2 }; push @lines, " acctnum=$acctNum"; print for map { s/\s+/$letter++ . ' '/e; "$_\n" } @lines; } __DATA__ Place your data here...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: raw data formatting
by Anonymous Monk on Nov 16, 2012 at 14:18 UTC | |
by Kenosis (Priest) on Nov 16, 2012 at 14:27 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 14:33 UTC | |
by Kenosis (Priest) on Nov 16, 2012 at 14:38 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 14:42 UTC | |
|
Re^8: raw data formatting
by teamassociated (Sexton) on Nov 16, 2012 at 15:07 UTC |