bash – 将两个命令的输出连接成一行

我有一个非常基本的 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

命令计算一些PSNR值,并为文件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,1031
Alt_moabit  10  1    total  47,8197
Alt_moabit  12  0    total  47,6755
Alt_moabit  12  1    total  47,3476

我该如何实现呢?

(如果您认为有更合适的话,请随时更改标题)

(GNU版本)echo实用程序有一个-n选项可以省略尾随的换行符.用你的第一个回声.您可能需要在第一行之后或第二行之前放置一些空格以供阅读.

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...