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

前端 未结 6 901
小蘑菇
小蘑菇 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:17

    Use

    find  -print0 | \
     grep -z stringinfilenamesIwant | \
     grep -zv stringinfilesnamesIdont | \
     xargs -0 dosomecommand
    

    However, the pattern may not contain newline, see bug report.

提交回复
热议问题