//View Tip #64
Similar Tips
» Grep for word in directory
» Stream shell commands to Twitter
» Remove empty directories
» Random IP addresses
» Find files greater than a certain size

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
example, look for all the TODO and HACK strings I left in large java project and show a bit of context before and after using the -C switch of grep.


find path_to_start | grep \\.java | xargs egrep -C3 "TODO|HACK" | less



View Comments »




Comments 

Add your comment

Comments are currently disabled
goteguru
using builtin switch of find should be faster: find path_to_start -iname "*.java" | xargs egrep -C3 "TODO|HACK" | less
Posted 2008-10-20 19:36:28
how about using grep ALONE? 8)

 egrep -C3 "TODO|HACK" -R --include='*.java' path_to_start | less
Posted 2009-02-11 17:42:28

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit