These are a couple of scripts that you can use to query the content of Thunderbird address book files. Documentation how to setup stuff up are in m_tbabook. They use the mork parser from http://tarvid.kallimagarden.com/mork by Juraj Svec. Without his work, this would have not been possible.