Recursively search for text in files in Linux/Unix


When using linux/Unix, sometimes we need to to find files the contains a specific text, to do so use the below command:



find . -name "*.c" -print | xargs grep "targettext"


Here we are trying to search for files with c code [using *.c] that contains the text "targettext"


Resource: http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/

Comments

Popular Posts