The “-” is used to specify that the data follows the plot command. So if you use it, you’ll need to do something like:
echo "set datafile separator \",\"; plot '-' using 1:2 with lines, '' using 1:3 with lines;" | cat - datafile.dat | gnuplot -p
(Quoting above probably needs to be escaped).
What’re you looking for is this:
plot '< cat -'
Now, you can do:
cat test | sed ... | gnuplot -p "plot '< cat -' using ..."
Note that you might need to feed in the input data via stdin multiple times if you’re using options with plot, like so:
cat testfile testfile | gnuplot -p "plot '< cat -' using 1, '' using 2"
In the above case, testfile must end with a line that has the sole character ‘e’ in it.
Manual reference