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?

1 Answers1

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