[NTLUG:Discuss] searching text in all files for match

Allen Flick allenflick at attbi.com
Wed Jun 5 11:08:13 CDT 2002


Chris Cox wrote:

> Fred James wrote:
>
> > My brain is stuck - trying to remember how to search all text files on
> > the machine for matches to a text string.  Any nudges?
> >
> find . -type f | xargs file | grep -i text | cut -f1 -d: | xargs grep
> "search for this"

Ironic.  I was once turned down for employment because during a
telephone interview I was asked what Unix command would do
such & so, and the answer ended up being a string of commands
like the above. The young guy doing the interview smuggly informed
me that one line is one command, and little was said after that.





More information about the Discuss mailing list