my $temp; my $header = <DATA>; while( <DATA> ){ my ($id, $data) = /(\S+)(.+)/; open my $fh, '>>', $id or die "cannot open file $id: $!"; print $fh $header if $temp ne $id; print $fh $id, $data, $/; $temp = $id; } __DATA__ Usr1369***12556 06-01-0101:00 1169 <snipped off> 06-01-0101:00 2396 <snipped off> 06-01-0103:12 1169 <snipped off> 06-01-0103:12 2569 <snipped off> 06-01-0301:00 1169 <snipped off> 06-01-0301:00 2396 <snipped off>
In reply to Re: Split file based on field
by sh1tn
in thread Split file based on field
by calv1n
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |