Command to find all text files having a particular word in them in Unix.
find . -type f -name "*.txt" | xargs grep -in "WORD_TO_BE_SEARCHED"
-i ignores the alphabets case
-n prints the line number of the found word
OR
This command too works fine and easy to use.
grep --color -ir "WORD_TO_BE_SEARCHED"
--color is for highlighting the found word on the Linux console.
-i ignores the alphabets case
-r for recursively searching directories under directories
find . -type f -name "*.txt" | xargs grep -in "WORD_TO_BE_SEARCHED"
-i ignores the alphabets case
-n prints the line number of the found word
OR
This command too works fine and easy to use.
grep --color -ir "WORD_TO_BE_SEARCHED"
--color is for highlighting the found word on the Linux console.
-i ignores the alphabets case
-r for recursively searching directories under directories
No comments:
Post a Comment