How to run grep inside awk?

后端 未结 6 2139
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 11:22

Suppose I have a file input.txt with few columns and few rows, the first column is the key, and a directory dir with files which contain some of these

6条回答
  •  你的背包
    2021-02-15 12:01

    Try following

    awk '{print $1}' input.txt | xargs -n 1 -I pattern grep -rn pattern dir
    

提交回复
热议问题