3

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?

6

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$//'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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