LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Search files with a special word (https://www.linuxquestions.org/questions/linux-newbie-8/search-files-with-a-special-word-930953/)

speigel205 02-23-2012 06:02 PM

Search files with a special word
 
Hi, I want to search all the files *.txt in the directory /home to find files that contains the word "tag" like xytag or Tag123 or /tAg. Regards

suicidaleggroll 02-23-2012 06:03 PM

Code:

grep -i tag /home/*.txt
If you want it to be a recursive search (including .txt files inside subdirectories), you can use find:

Code:

find /home/ -iname "*.txt" | xargs grep -i tag

speigel205 02-23-2012 06:11 PM

Thank you


All times are GMT -5. The time now is 06:12 AM.