开发者

why isn't this regex working: find ./ -regex '.*[mh]$' | sort | grep --exclude="UnitTests" *

why isn't this regex working:

   find ./ -regex '.*[mh]$' | sort | grep --exclude="UnitTests" *

The following works:

   find ./ -regex '.*[mh]$' | sort
   find ./ -regex '.*[开发者_如何学运维mh]$' | sort | grep "UnitTests"     

When I'm adding the "--exclude" (as I want everything but lines with UnitTests in them) I seem to come to grief.

I'm on Mac OSX


Use

find ./ -regex '.*[mh]$' | sort | grep -v "UnitTests"

instead. --exclude is used when recursing subdirectories, but your grep is done based on the pipe (the output) from find ./ -regex '.*[mh]$' | sort.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜