I've few thousands terms in my vocabulary. I'd like to find out which one still are missing (without adding them) based on the list of term names.

I believe this can be achieved by some anti-join sql query, but any solution would be fine.

How this can be achieved?


If the list is in text file (list.txt), this can be achieved by grep comparision.

First, extract the list of terms from the database by drush:

$ drush sqlq "SELECT name FROM taxonomy_term_data -- WHERE vid = 1" > my_list.txt

Then compare the two lists:

$ grep -Fxv -f my_list.txt list.txt

This will print all the term names which doesn't exist in my_list.txt file.

This solution is based on: Is there a tool to get the lines in one file that are not in another?.

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.