cngf-pf-plot-point-evol (782B)
1 #!/bin/sh 2 3 usage() { 4 printf 'usage: %s [-f field] [-h] [-l label] [-p point] [-t term] file..\n' "${0##*/}" 1>&2 5 } 6 7 field="2" 8 label="shear velocity [m/s]" 9 term="pdf" 10 point="-1" 11 while getopts 'f:hl:p:t:' arg; do 12 case "${arg}" in 13 f) field="${OPTARG}" ;; 14 h) usage; exit 0 ;; 15 l) label="${OPTARG}" ;; 16 p) point="${OPTARG}" ;; 17 t) term="${OPTARG}" ;; 18 *) usage; exit 1 ;; 19 esac 20 done 21 shift $((OPTIND - 1)) 22 23 if test "$point" -lt 1; then 24 rowsel="tail -n "$(printf '%d * -1\n' "$point" | bc)"" 25 trim="head -n 1" 26 else 27 rowsel="head -n ${point}" 28 trim="tail -n 1" 29 fi 30 31 for f in "$@"; do 32 $rowsel "$f" | $trim 33 done | \ 34 gnuplot -e "set term ${term};\ 35 set xlabel 'Output file [-]';\ 36 set ylabel '${label}';\ 37 plot '-' u 0:${field} with lines title ''"