What needs to be done is to split the file into multiple files based upon the first field such as 06-01-0101:00 So the output file will beUsr1369***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>
I can get the header and one line by usingUsr1369***12556 06-01-0101:00 1169 <snipped off> 06-01-0101:00 2396 <snipped off> Usr1369***12556 06-01-0103:12 1169 <snipped off> 06-01-0103:12 2569 <snipped off> Usr1369***12556 06-01-0301:00 1169 <snipped off> 06-01-0301:00 2396 <snipped off>
Then I get the outputfile handler and domy @filedata = <IFILE_HANDLER>; my $head = shift(@filedata); my $line foreach $line(@filedata);
I haven't the faintest idea of how to group it such that I get one file for each combination of ^\d{2}-\d{2}-\d{4}:\d{2} Would appreciate any help you guys could give.print (OFILE_HANDLER "$head"); print (OFILE_HANDLER "$line"); close (OFILE_HANDLER);
In reply to Split file based on field by calv1n
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |