#!/sw/bin/perl5 use strict; my $new_platform = ""; while (<>) { if ( m/Build on\s+(\S+):\s/ ) { $new_platform = $1; print "Found ($new_platform)\n"; last; } } if (! $new_platform ) { print "No platform\n"; } while ($new_platform) { open PLATFORM_OUTPUT, ">$new_platform" or die; $new_platform = ""; print PLATFORM_OUTPUT $_; while (<>) { if ( m/Build on\s+(\S+):\s/ ) { $new_platform = $1; print "Found ($new_platform)\n"; last; } else { print PLATFORM_OUTPUT $_; } } }