【发布时间】:2020-04-14 21:02:12
【问题描述】:
在 AIX 7.X 中,我的 gnuplot 脚本有这些行:
set terminal png truecolor size 1950, 650 background rgb "#eff1f0"
set output "/xxx/xxxx/xxx/xxx/xxx.png"
set datafile separator ';'
set size ratio 0.2
set bmargin at screen 0.2
unset key
set datafile separator ";"
set ylabel " MB BLOCK " font ",10" offset -1,0
set xlabel font ",10"
set xtics rotate by 45 offset -0.8,-9,-1.8
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5
我想删除所有行的模式“ plot ”,除了第一行...使用我的 linux 我这样做:
sed '0,/plot/! s/plot//g' myfile.txt
结果是:
set terminal png truecolor size 1950, 650 background rgb "#eff1f0"
set output "/var/IBMtools/www/tim/used.png"
set datafile separator ';'
set size ratio 0.2
set bmargin at screen 0.2
unset key
set datafile separator ";"
set ylabel " MB BLOCK " font ",10" offset -1,0
set xlabel font ",10"
set xtics rotate by 45 offset -0.8,-9,-1.8
plot "xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
"xx/xx/file.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5
但此命令不适用于 AIX。错误是sed: 0602-403 0,/plot/! s/plot//g is not a recognized function.
拜托,你能告诉我怎么做吗?
【问题讨论】:
-
你可以试试
seq 3 | sed -n '1,2p'吗?seq 3 | sed -n '1,/2/p'?seq 3 | sed '1,/2/s/1/a/'?哦,我认为0作为地址不是posix,sed '1,/plot/!s/plot//'可以工作吗? -
您好,我添加了一些细节以便更清楚!
-
@HK2432,请问我的解决方案是否对您有所帮助?