#!/bin/csh
if ( $#argv == 0 || x"$1" == "x-h" ) then
  cat - <<EOF
Syntax: getvalue [label]
Script that scans standard input for a given label and
write, to standard output, the numerical value following
every occurence of that label.
Any number of : = spaces or tabs can separate the label and the number.
Example: getvalue "Final energy" < gulp.output
EOF
  exit
endif

sed "s/$1[=:	 ]*[-+.0-9][-+.0-9eEdD]*/\\
xxx&\\
/g" | grep "xxx$1" | sed "s/xxx$1[=:	 ]*//g"
