Find files excluding a string 

Newsgroups: comp.unix.questions
> > I want to find a list of files that does not contain a given string.
> >
>
> for files in the current directory,
> in the korn shell, you can do this:
>
> |    $ for f in *
> |    > do
> |    > [[ ! -f $f || ! -r $f ]] && continue
> |    > ! grep -q string $f && print $f
> |    > done
>
> In bash, change `print' to `echo'

It's probably easier to read it as:

[[ -f $f -a -r $f ]] || continue

which means:

Unless $f is a regular file and it is readable, continue to the next item in the list.

documented on: 2001.02.12