use strict;
if ($#ARGV < 0) { print "No otf filename\n"; exit; }
if ( !(-e $ARGV[0]) ) { print "otf file $ARGV[0] does not exist\n"; exit; } open (OTF, "< $ARGV[0]"); my $n; my $t = 1.0e+20; while ( <OTF>) { if (/ (\d+) smallest timesteps/) { $n = $1; if ($n > 5) { $n = 5; } <OTF>; <OTF>; for (my $i=0; $i<$n; $i++) { $_ = <OTF>; print $_; my @f = split; if ($f[$#f] < $t) { $t = $f[$#f]; } } print "VAR TIMESTEP VALUE=\"$t\"\n"; exit; } } close (OTF);
|