【问题标题】:Add an echo after a grep search在 grep 搜索后添加回显
【发布时间】:2016-05-08 15:47:52
【问题描述】:

有没有办法在 grep 命令后添加回显?

例如,如果我运行这个:

grep -R $id && echo appearances in database

输出是

listofids.txt:226526658 201
appearances in database

有没有办法让它这样显示:

listofids.txt:226526658 201 appearances in database

我尝试了一些想到的想法,但没有奏效,例如:

echo "" grep -R $id "appearances in database"

我知道这行不通,但我认为值得一试。

【问题讨论】:

    标签: linux bash grep echo gnome-terminal


    【解决方案1】:

    应该这样做:

    echo "$(grep -R $id) appearances in database"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-07
      • 1970-01-01
      • 2018-11-24
      • 2022-06-20
      • 2011-09-05
      • 2014-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多