2017-11-24 18 views
0

シェルで実行されるスクリプトを作成して、gnuplotを使用して複数の行をグラフにプロットするディレクトリ内の複数のtxtファイルを使用しようとしました。したがって、1つの画像のコマンドを入力すると、結果は想像されるようになります。ここでは、コマンドを見ることができます:複数のグラフをgnuplotにプロットするスクリプト

plot "test2.txt" using 2:1 w filledcurves lc "red" title "Red Channel", 
"text2.txt" using 3:1 w filledcurves lc "green" title "Green Channel", 
"text2.txt" using 4:1 w filledcurves lc "blue" title "Blue Channel" 

は今私のスクリプトは次のようになります。

[...] for i in 'ls -1 *.txt' 
do 
cat $1| 
tr ":()" " " | 
gnuplot -p -e 'set terminal jpeg; set output "'$1'.jpeg";plot "/dev/stdin" using 2:1 w filledcurves lc "red" title "Red Channel", "/dev/stdin" using 3:1 w filledcurves lc "green" title "Green Channel", "/dev/stdin" using 4:1 w filledcurves lc "blue" title "Blue Channel"' 
done 

スクリプトは、すべてのtxtファイルを編集し、JPGが作成されますが、最初のグラフ、「赤チャンネルで"私はまた別の行の間に, \のような分離を交互に試みましたが、うまくいきませんでした。また、 "/ dev/stdin"の代わりに''を使用しようとしましたが、何も起こりません。

答えて

0

最初のplotstdin全体を消費するため、何をしようとしても機能しません。他にも問題があります。私がテストするために、コンピュータではないですが、私はあなたと近いだろうと思う:私は同じを使用してください、私のiPadは、単純なものの代わりに派手なものを入れて、引用符の混乱を作っていると思い

for i in *.txt ; do 
    tr ‘:()’ ‘ ‘ < “$i” > /tmp/a.txt 
    gnuplot -pe ‘set terminal jpeg; set output “/tmp/a.jpg”; plot “/tmp/a.txt” ... ‘ 
    mv /tmp/a.jpg “${i}.jpeg” 
done 
+0

あなたが元々持っていたように引用符。 –

関連する問題