in reply to Help spliting file into chunks

If your file is sorted as shown, you just have to read through it one line @ a time and check for a change of the first field in the record...warning untested but something like the following
use strict; use warnings; my ($FH, $OUT,$past,$record,$count); open ($FH,"<","$ARGV[0]"); $record=""; $count=0; while ($line=<$FH>){ my($key ,@record)=split(/\s+/, $line); if $past ne $key){ $count++; if ($count == 100){ open ($OUT, ">" $past); print $OUT $record; close $OUT; $record=""; $count=0; } $past=$key; } $record.= $line; } open ($OUT, ">" $past); print $OUT $record; close $OUT;
Update: Added counter