I m trying to get the first element of a file within gnuplot:
data = "file.dat"
x = `cat data | head -n 2 | tail -n 1 | awk '{print $1}'`
but this keeps giving me the following error:
no such file or directory
I should write something like
x = cat $data | head -n 2 | tail -n 1 | awk '{print $1}'
(with dollar)
Obviouly, this is also not correct.
Any ideas?
You need to use a
set macro
and then use the symbol @
to get the value of the variable data
(@
in Gnuplot is like $
in bash)
so this should work
x = `cat @data | head -n 2 | tail -n 1 | awk '{print $1}'`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With