//View Tip #64
Similar Tips
» Find files greater than a certain size
» Randomize lines in a file
» Find words in garbled text
» Find last modified files on a filesystem
» Random password generator.


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 »


Add your comment

Comments are currently disabled
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