Thursday, September 6, 2012

unix - using ack to replace find/grep & address --exclude/--include syntax needs (do not grep through certain files) - from Stack Overflow

Please take a look at ack, which is designed for exactly these situations. Your example of
grep -ircl --exclude=*.{png,jpg} "foo=" *
is done with ack as
ack -icl "foo="
because ack never looks in binary files by default, and -r is on by default. And if you want only CPP and H files, then just do
ack -icl --cpp "foo="
share|improve this answer
Looks nice, will try the standalone Perl version next time, thanks. – Piskvor Oct 21 '08 at 14:39
2 
Good call, I can no longer live without ack. – Chance Nov 15 '10 at 21:21
1 
stackoverflow.com/questions/667471/… - This will allow you to get ack on windows, if that is where you are running grep from. – TamusJRoyce Dec 15 '10 at 16:58
Thank you for your feedback.

unix - grep --exclude/--include syntax (do not grep through certain files) - Stack Overflow

'via Blog this'

No comments:

Post a Comment