[Linux] Find/search text in file under directory

Posted by cikul | Posted in Linux | Posted on 12-03-2013-05-2008


To search text in file under directory/subdirectory, for example we want to find php file under /home directory contains text “eval” in the content, we can use command :

shell [~]# find /home/ -name "*".php -type f -print0| xargs -0 egrep "eval" | uniq -c | sort -u | cut -d":" -f1 | awk '{print "Warning - please check this files " $2}' | uniq > eval.log

Share and Enjoy

Write a comment