#!/bin/sh

if [ "$1" = "" ] ; then
  FILES=body
else
  FILES=$@
fi

for FILE in $FILES ; do
  awk '
  !/^#/ && (NF>0){
    s=$4;
    for (i=5; i<=NF; i++) {
      s = s " " $i;
    }
  print "set label \"  " s " (" $3 ")" "\" at " $2 "," $1 " font \"Helvetica,8\" front";
  }' $FILE.dat > $FILE.plt
done

