grep -oF -f firstfile secondfile | sort | uniq -c