I would do something like this (probably not the most elegant, but it works). It needs to be tweaked if you have duplicate filenames within the archives, and will leave you with some empty directories after the extract/move, but should be easy enough to clean up.
Code:
#!/bin/bash
for i in $(ls *.gz)
do
for j in $(tar -tzf $i | grep "search string")
do
tar -zxvf $i $j
mv -v $j output_directory/
done
done
exit