Is there a grep equivalent for find's -print0 and xargs's -0 switches?

前端 未结 6 924
小蘑菇
小蘑菇 2020-12-04 23:36

I often want to write commands like this (in zsh, if it\'s relevant):

find  | \\
    grep stringinfilenamesIwant | \\
          


        
6条回答
  •  粉色の甜心
    2020-12-05 00:10

    As you are already using GNU find you can use its internal regular expression pattern matching capabilities instead of these grep, eg:

    find  -regex ".*stringinfilenamesIwant.*" ! -regex ".*stringinfilesnamesIdont.*" -exec dosomecommand {} + 
    

提交回复
热议问题