Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot and bash process substitution

Does gnuplot allow bash process substitution?

In gnuplot I can do:

plot "<join tmp1 tmp2" u 2:3

But I can't get this to work:

plot "<join tmp1 <(join tmp2 tmp3)" u 2:3

Should it work, or isn't bash process substitution supported in gnuplot?

Here are 3 example input files:

cat tmp1

A 1
B 2
C 3

cat tmp2

B 3
C
D 6

cat tmp3

A 4
B 6
C 8
D 10
E 12
like image 596
tommy.carstensen Avatar asked Oct 10 '13 08:10

tommy.carstensen


1 Answers

The command following the < is executed with popen(), which uses /bin/sh (see man popen). So you must invoke bash explicitely in order to make use of the process substitution:

plot '< exec bash -c "join tmp1 <(join tmp2 tmp3)"' using 2:3

In your case with the single substitution the following would also do:

plot '< join tmp2 tmp3 | join tmp1 -' using 2:3
like image 86
Christoph Avatar answered Sep 16 '22 20:09

Christoph