【发布时间】:2011-07-23 20:44:34
【问题描述】:
我这里有一个非常基本的 shell 脚本:
for file in Alt_moabit Book_arrival Door_flowers Leaving_laptop
do
for qp in 10 12 15 19 22 25 32 39 45 60
do
for i in 0 1
do
echo "$file\t$qp\t$i" >> psnr.txt
./command > $file-$qp-psnr.txt 2>> psnr.txt
done
done
done
command 计算一些 PSNR 值并将详细摘要写入文件中,以针对 file、qp 和 i 的每个组合。没关系。
2>> 输出我真正需要的一行信息。但是当执行时,我得到:
Alt_moabit 10 0
total 47,8221 50,6329 50,1031
Alt_moabit 10 1
total 47,8408 49,9973 49,8197
Alt_moabit 12 0
total 47,0665 50,1457 49,6755
Alt_moabit 12 1
total 47,1193 49,4284 49,3476
然而,我想要的是:
Alt_moabit 10 0 total 47,8221 50,6329 50,1031
Alt_moabit 10 1 total 47,8408 49,9973 49,8197
Alt_moabit 12 0 total 47,0665 50,1457 49,6755
Alt_moabit 12 1 total 47,1193 49,4284 49,3476
我怎样才能做到这一点?
(如果您认为有更合适的标题,请随时更改标题)
【问题讨论】:
-
正是我今天所需要的!谢谢!
标签: bash shell concatenation