Can you mass edit all files returned in a grep?

后端 未结 6 2086
失恋的感觉
失恋的感觉 2020-12-24 04:35

I want to mass-edit a ton of files that are returned in a grep. (I know, I should get better at sed).

So if I do:

grep -rnI \'xg_icon-*\'
         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 05:22

    A nice general solution to this is to use xargs to convert a stdout from a process like grep to an argument list.

    A la:

    grep -rIl 'xg_icon-*' | xargs vi
    

提交回复
热议问题