#!/usr/bin/perl # the above is the standard linux/unix path for perl: change if your computer is nonstandard sub print_help{ print STDERR <0 or die "Invalid number of skipped frames $skip\n"; next; } if($p eq "-b"){ # beginning $beg=shift(@ARGV)+0; $beg>=0 or die "Invalid beginning frame frame $beg\n"; next; } if($p eq "-e"){ # end $end=shift(@ARGV)+0; $end>=0 or die "Invalid end frame frame $end\n"; next; } if($p eq "-h"){ # help print_help; die "\n"; } print_help; die "invalid option $p\n"; } if($#inputfiles<0){ push(@inputfiles,"-"); # adds stdio for lack of arguments } while ($filename=shift(@inputfiles)){ open(INPUT, $filename) || die "Cannot open $filename\n"; $count=0; #so that the included frames are multiples of $skip while(){ s/^\s*//; # remove leading spaces @li = split('\s+'); if($#li==0 && $li[0]+0==$li[0] & $li[0]+0>0){ $count++; } $c=$count-$beg; if($c>=0 && $c%$skip ==0 && $count<=$end){ print; } } close(INPUT); }