( while read; do grep -cFe "$REPLY" secondfile; done ) < firstfile