#!/bin/csh -f
if ($#argv < 1) then echo "No otf filename"; exit; endif
if ( !(-e $argv[1]) ) then echo "otf file $argv[1] does not exist"; exit; endif
awk '/smallest timesteps/ { # search for smallest timestep \ n = $1; # save how many found \ getline; # skip a line \ getline; # skip a line \ if (n > 5) n = 5; # limit to 5 timesteps \ t = 1.0e+20; # initialise smallest timestep \ for (i=0; i<n; i++) # loop over lines \ { # \ getline; # read the line \ print $0; # print it \ if ($NF < t) t = $NF; # save timestep if smaller \ } # than current smallest \ } # \ END { # \ printf ("VAR TIMESTEP VALUE=\"%e\"\n", t); # Print smallest timestep \ } # \ ' $argv[1] |