10 January 2009

How to find a String or text value in specific type of files in Linux

I am not trying to post a grep or find reference manual but the below command will come handy in the following situations, (when searching in Java files)
  1. To search for TODO in code
  2. To search for System.out.println in code
Of course Eclipse or NetBeans will display this but I find my Ubuntu searching and displaying the results at lightning speed.

find . -name "*.java" |xargs grep TODO