find + sed, filename output
<p>I have directory: <code>D:/Temp</code>, where there are a lot of subfolders with text files. Each folder has "file.txt". In some file.txt files is a word - "pattern". I would like check how many pattern words there are, and also get the filepath to that file.txt:</p>

<pre><code>find D:/Temp -type f -name "file.txt" -exec basename {} cat {}  \; | sed -n '/pattern/p' | wc -l
</code></pre>

<p>Output should be:</p>

<pre><code>4
D:/Temp/abc1/file.txt
D:/Temp/abc2/file.txt
D:/Temp/abc3/file.txt
D:/Temp/abc4/file.txt
</code></pre>

<p>Or similar.</p>