对于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.
请,你能告诉我怎么做吗?
答案 0 :(得分:0)
如果您可以使用awk
解决方案,请尝试以下方法。
awk '/plot/ && ++count==1{print;next} !/plot/' Input_file
说明: 添加上述代码的说明。
awk ' ##Starting awk program from here.
/plot/ && ++count==1{ ##Checking condition if string plot is present and variable count value is 1 then do following.
print ##Printing the current line.
next ##next will skip all further statements from here.
} ##Closing BLOCK for above condition.
!/plot/ ##Checking condition if string plot is NOT present then do print of that line.
' Input_file ##Mentioning Input_file name here.
注意: :如果要将输出保存到Input_file本身,请在上述代码后附加> temp && mv temp Input_file
。
答案 1 :(得分:0)
如果绘图不在文件的第一行,则可以执行以下操作:
def convertJsonToListModel[T](json: JsValue)(implicit reads: Reads[T]): List[T] = {
val conversionResult: JsResult[List[T]] = json.validate[List[T]]
conversionResult match {
case s: JsSuccess[List[T]] => s.get
case e: JsError => e.get
}
}
如果它可以出现在第一行,那么我只能循环播放它:
sed '1,/plot/!s/plot//'