Thursday 27 August 2015

How to search or find text recursively in all files and folders?

Ideally this works :

 find . -name "*.*" | xargs grep "MyTextToSearch"


But when you have spaces between the file names / folders - this doesn't works in few OS where GNU find is not installed.

In such case, on one of the Solaris Machine the following worked
find . -name "*.*" -exec grep -l "MyTextToSearch" {} \;

No comments:

Post a Comment