Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

grep -i v=spf *.db

/var/named/domain.com.db

domain.com.  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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.