//View Tip #64
Similar Tips
» Change prompt color dynamically
» Calendar with today colored [handle single digit dates]
» ssh proxy forwarding
» Change file extension revisited
» Crawl a web page for links

 

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