开发者

How to manipulate column values when using gnuplot from a shell script?

开发者 https://www.devze.com 2023-01-24 20:38 出处:网络
I\'m using gnuplot from a bash script and I have to divide values from two columns: plot \"results.csv\" using 1:($4/$6) notitle with lp

I'm using gnuplot from a bash script and I have to divide values from two columns:

plot "results.csv" using 1:($4/$6) notitle with lp

This works fine in gnuplot interactive mode, but when called from a script, the column values get mixed up with bash开发者_运维技巧 script arguments...How can I pass the col. values from the script?


This depends on how exactly you're invoking gnuplot from your script, as Sean asked in the comments.

Something like $4 will be expanded unless it's in single quotes, so that's one option. Anywhere else, you'll have to escape the $:

# print first argument
echo $1

# print literally $1, a few ways
echo '$1'
echo "\$1"
echo \$1
0

精彩评论

暂无评论...
验证码 换一张
取 消