Search All Files on System? For Strings Inside?

I still don't have an acceptable Search function; one which will not only search all directories but also for strings inside files. I've found that I can enable many more directories in Spotlight by removing them from /System/Library/Finder/SkipFolders... takes longer for results, but I can wait. But this doesn't help with searching for text inside of files. How to search for text inside of files? It'd be best if I can limit the directories searched, but not critical and I can wait.

After having used the wonderful Konqueror for years, Finder seems clunky and limited. I've looked at PathFinder and would be willing to pay for it, but it seems little improvement.

IBM A22P, Debian Linux (8 years), Etch

Posted on Sep 9, 2007 6:26 AM

Reply
9 replies

Sep 9, 2007 12:03 PM in response to Quantumstate

The Finder is clunky. Among other things. But I suspect the problem you are having is that the content of files is not indexed by Spotlight unless there is an mdimporter for the file type, and if you are trying to locate the content of system files such as "hostconfig" which have no extension, and thus no mdimporter, you're out of luck. Remember: the Mac GUI is designed to be easy to use for the average consumer who want to do email, surf the web, do things with their digital photos. That sort of user.

For what you want to do you may find just using the command line is the best solution. Thus, to find the string "unknown" in /private/etc I would use grep in the Terminal:

NoobiX:~ francine$ cd /private/etc/
NoobiX:/private/etc francine$ sudo grep "unknown" *
aliases:# late a "user unknown" error, and |"exit 0" to
ftpusers:unknown
group:unknown:*:99:
master.passwd:unknown:*:99:99::0:0:Unknown User:/var/empty:/usr/bin/false
passwd:unknown:*:99:99:Unknown User:/var/empty:/usr/bin/false
rc.common: * ) echo "$0: unknown argument: $1";;
rc.netboot: Failed "root device unknown"
rc.netboot: *) echo "unknown network filesystem mount from ${mount_from}"
smb.conf: guest account = unknown
smb.conf.template: guest account = unknown
ttys:fax "/usr/bin/fax answer" unknown off
ttys:tty00 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty01 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty02 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty03 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty04 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty05 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty06 "/usr/libexec/getty std.9600" unknown off secure
ttys:tty07 "/usr/libexec/getty std.9600" unknown off secure

Grep is really powerful if you know how to use it (I don't really--when I wanted to find a batch of html files that did not contain the DOCTYPE declaration I called my UNIX guru brother and asked him to construct the command, he did and it worked beautifully).
Francine

User uploaded file
Francine
Schwieder

Sep 10, 2007 5:16 AM in response to Quantumstate

I have found that BBEdit is a great application for searching exact[/b text strings. It will even list the docs and the line numbers of the search phrase. It can be extremely fast, however, it does not index the volume as Spotlight does. Consequently, unless you are only searching specific areas, it could take a while if the search area is extensive.

But remember that to Search for exact phrase inside documents the phrase must be exact. No typos. No spaces.

Considering that I have literally millions of docs on my drives, it is just simpler to use Spotlight. Sure I may get thousands of hits, just typing additional letter(s) (or word(s) in any order) dynamically as the list appears, Spotlight cuts down the list significantly, and instantaneously.

To use BBEdit, doing a ‘Multi-File Search’:

1) Put all your BBEdit* readable files in one FOLDER**
2) Open BBEdit
3) Command-f
4) Type in your search string
5) Check ‘Match Entire Words’
6) Check ‘Multi-File Search’
7) Check ‘Batch Find’
8) Select the FOLDER containg you BBEdit readable files
9) Hit Enter

Voila, you will get a list of all the files by name and the corresponding line numbers that contain your search string. Note that if you don’t check ‘Batch Find’, BBEdit will open all the files that contain the text string and highlight every occurrence.

*There is no indexing and it works on any file type that BBEdit can open and read, e.g., Word, text apps, PowerPoint, even InDesign.

**BBEdit will even search in nested folders (Check options). If you wanted to, you could select your entire drive, but speed will depend on the number and size of the files that it has to search through.

Now all you have to do is write a script (Quickeys), Automator and/or Smart folder and you have created your own personal search engine.

Sep 10, 2007 9:11 AM in response to Quantumstate

You get what you pay for. TextWrangler is to BBEdit as Adobe Reader is to Acrobat.

However, TextWrangler will do the same thing. See #7 on page120 of the TextWrangler User Manual that is included in the current version.

See also pages 121-123
*Multi-File Search Results* and *Searching the files in a folder*
For example, +To search the files in a folder, click on the box next to the double-click its name, in the Sources drawer. If the folder is not in the Sources drawer, click the Other button at the and pick the folder using the resulting selection sheet. You can also drag a folder (or even you entire drive) from the Finder directly into the Find & Replace dialog to choose it as the source.+

Good luck

Message was edited by: Daniel Marr

Sep 10, 2007 9:12 AM in response to Quantumstate

Quantumstate wrote:
I still don't have an acceptable Search function; one which will not only search all directories but also for strings inside files. I've found that I can enable many more directories in Spotlight by removing them from /System/Library/Finder/SkipFolders... takes longer for results, but I can wait. But this doesn't help with searching for text inside of files. How to search for text inside of files? It'd be best if I can limit the directories searched, but not critical and I can wait.


Use EasyFind. It's easy and it finds text in any kind of file (because all it does is search every inch of your hard drive). It's not fast, of course, but sometimes it's the perfect solution.

http://www.devon-technologies.com/products/freeware/

Sep 10, 2007 10:52 AM in response to Quantumstate

Hmm. I use EasyFind and like it. But don't count on it necessarily finding the strings you are looking for. Thus, I did a search in /private/etc using grep and EasyFind on "SMBSERVER" and grep located the hostconfig file. EasyFind returned nothing at all--that's why I recommended grep initially. Same deal with the example I used above. I just tried copying one of the files (the ftpusers file) to my desktop and did the search there with EasyFind on file contents. EasyFind returned two other files that contained "unknown" in the contents, but did NOT show the ftpusers file. The two files it found were .html files, so I've concluded it is not a problem with permissions but rather that it does not search the content of files without extensions. Perhaps it will do what you want, but if I understand your needs, well, try grep and EasyFind on the same search and see. Maybe you'll get what you want, but I wouldn't count on it. BTW, I have BBEdite 6.5.2 and tried it on the Desktop and it worked best of all, it returned the documents, including the line the word appeared in, clicking on the line it opened the doc with the line hi-lighted so you could edit it right then and there (couldn't figure out how to get it to search the /private/etc folder, no doubt there is a way, but I never used it for a search before).
Francine

User uploaded file
Francine
Schwieder

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Search All Files on System? For Strings Inside?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.