加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 18:45:32 所属栏目:安全 来源:网络整理
导读:我有一个非常基本的 shell脚本: for file in Alt_moabit Book_arrival Door_flowers Leaving_laptopdo for qp in 10 12 15 19 22 25 32 39 45 60 do for i in 0 1 do echo "$filet$qpt$i" psnr.txt ./command $file-$qp-psnr.txt 2 psnr.txt done donedon
我有一个非常基本的 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 "$filet$qpt$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选项可以省略尾随的换行符.用你的第一个回声.您可能需要在第一行之后或第二行之前放置一些空格以供阅读.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读