Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a lot of files which already have SPF records defined

grep -i v=spf *.db

/var/named/  14400   IN      TXT     "v=spf1 +a +mx +ip4:XXX.XXX.XXX.XXX ?all"

And want to find all files without SPF records. Some hints?

share|improve this question
up vote 6 down vote accepted

GNU grep has the -L option, the inverse of -l. It lists files with no matches. So you can do

grep -iL v=spf *.db

With a more traditional grep, you can do a -c count and then select the ones that have a count of 0 matches:

grep -ic v=spf *.db | grep ':0$' | sed 's/:0$//'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.