#!/bin/sh
if [ "$#" = 0 ]; then 
 echo "usage: $0 filenames"
 echo "column 2 vs column 1 is plotted"
 echo " blank lines work like separators"
 echo " filename - stands for standard input"

 exit
fi

echo "-0.3737 -0.3737" > sep

S=$1; shift

while [ $1 ]; do
 S="$S sep $1"
 shift
done

cat `echo $S` | awk '{ if (NF == 0) print "-0.3737 -0.3737"; else print $0 }' > tmpxy$$
col1 < tmpxy$$ > tmpx$$
col2 < tmpxy$$ > tmpy$$

if [ "$S" = - ]; then
 S=stdin
fi

p tmpx$$ tmpy$$ -t "Plot of $S"
rm sep tmpx$$ tmpy$$ tmpxy$$
