in reply to Re: Re: Searching through text files
in thread Searching through text files

While this is definitely true for some regexps, Anonymous says in his question:

I have to write a script to search for a string, it has to search for a string in about a thousand different text files.

For strings, probably grep -F is fast enough.

If, however, the needle string contains newlines or nul characters, then this may be difficult to achieve with grep, so it may be better for perl. Also, if the file has very long lines (or no newlines at all), you can't make grep print only where the string is, it either wants to print the whole line, or the line number, or only give you a truth value. In such cases, Perl may be better (or some other program). Also, on windows, if you only have find installed, no real grep, you may have to use Perl.