When searching with
grep -r, it avoids following symbolic links by default. This is true for directories, but
grep still inspects the contents of files that are symlinks.
For instance, if I have a framework with the following structure:
+-- MyFancy.framework +-- MyFancy (symlink to ./Versions/A/MyFancy) +-- Versions +-- A +-- MyFancy (the actual binary file) +-- Current +-- MyFancy (symlink to ../A/MyFancy)
grep -r "string" MyFancy.framework prints:
Binary file ./MyFancy matches Binary file ./Versions/A/MyFancy matches Binary file ./Versions/Current/MyFancy matches
This causes the search in such structures three times slower.
How can I make
grep exclude symlinks?