in reply to Help for generating multiple file from singl e file and parsing it.
#!usr/bin/perl -w use strict; use Data::Dump qw(pp); my %data; foreach (<DATA>) { next if (/^\s*$/); #skip blank lines my ($str, $date) = m/^#RD(.+)?#OE.+?(\d+)/; push @{$data{"$str"."txt"}},"OE#$date"; } print pp \%data; =Prints { "#,3004,,,,,N,MANS.20111011.2,txt" => ["OE#284110217106"], "#,3023,,,,,N,MANS.20111011.2,txt" => ["OE#284110161544", "OE#284110 +161544"], } =cut __DATA__ #RD#,3023,,,,,N,MANS.20111011.2,#OE#,CR,N,284110161544,,Y,MANS,2011101 +1064839000,20111011~1M9LQV49HM #RD#,3023,,,,,N,MANS.20111011.2,#OE#,CR,N,284110161544,,Y,MANS,2011101 +1064839000,20111011~1M9LQV49HM,20111011064925000,20111011~1M9LQV49Ho, +,,20111011064925000 #RD#,3004,,,,,N,MANS.20111011.2,#OE#,RT,N,284110217106,,Y,MANS,2011101 +1065244000,20111011~1J6Q7ETYXH,,20111011~1J6Q7ETYXH,NVMI,201110110652 +44000,2324,E
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help for generating multiple file from singl e file and parsing it.
by sarf13 (Beadle) on Oct 16, 2011 at 04:47 UTC | |
by Marshall (Canon) on Oct 17, 2011 at 15:58 UTC | |
by sarf13 (Beadle) on Oct 17, 2011 at 17:48 UTC | |
by Marshall (Canon) on Oct 26, 2011 at 16:17 UTC |