in reply to Re: raw data formatting
in thread raw data formatting
# perl -c foobar Bareword found where operator expected at foobar line 12, near "s/\s+/ +$letter++ . ' '/er" syntax error at foobar line 12, near "s/\s+/$letter++ . ' '/er " foobar had compilation errors. root@facs04ap [/var/adm/scripts] # perl -v This is perl, v5.8.8 built for aix-thread-multi
code from u
use strict; use warnings; use List::MoreUtils qw/natatime/; my $it = natatime 5, <DATA>; while ( 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++ . ' '/er } @lines; print "\n"; } __DATA__ 50###### 8 Z Axxx ,xxxxxxx 19793.43 02/02/2012 06/08 +/2012 32989.05 037###### S JOYCE xxxxxxS .00 06/06/xxxx + 0 0 7 1471 xxxx xxxx x #101 .00 02/08/2012 + 06/15/2012 NOV 0 U MILWAUKEE, WI xxxxx 32989.05 02/08/2012 + 3 3##### MILWAUKEE WI .00 5321 +4 12 50##### 8 Z Axxx ,Nxxxxx 75.00 05/27/2012 06/ +05/2012 1845.00 03######3 E Nxxxx Axxxx .00 09/xx/xxxx 06/ +05/2012 MYT##### 7####### S 156xxx xxxxx BLVD .00 06/06/2012 06/ +14/2012 MYT######## NOV 0 C TAYLOR,MI 48180 1845.00 05/27/2012 + 3 3 37###### S TAYLOR MI .00 48 +180 3 12 50##### 9 Z ALxxxx Rxxxx ,SUSxxx 75.00 05/05/2012 05/15 +/2012 2045.00 0000000000 E SUSE Axxxxx Rxxxx .00 03/xx/xxxx 05/1 +5/2012 AJT9####### 31####### 44xxx xxx AVE .00 05/16/2012 0 +6/15/2012 AJT92###### NOV 0 C LINCOLN PARK,MI xxxxx 2045.00 05/05/2012 + 1 3 0 S LINCOLN PARK MI .00 4 +8146 1 12
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: raw data formatting
by Kenosis (Priest) on Nov 16, 2012 at 01:52 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 02:24 UTC | |
by Kenosis (Priest) on Nov 16, 2012 at 03:24 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 13:25 UTC | |
by marto (Cardinal) on Nov 16, 2012 at 13:40 UTC | |
| |
by Kenosis (Priest) on Nov 16, 2012 at 14:15 UTC | |
|