snipt

Ctrl+h for KB shortcuts

Bash

Search all files for a text string

find ./*/filename.txt -type f -exec grep -l "text to find" {} +
https://snipt.net/embed/656b4e2f785c6cdfbf4e6398fa0970d2/
/raw/656b4e2f785c6cdfbf4e6398fa0970d2/
656b4e2f785c6cdfbf4e6398fa0970d2
bash
Bash
1
2019-07-15T18:34:54
True
False
False
Feb 28, 2013 at 07:19 AM
/api/public/snipt/56697/
search-all-files-for-a-text-string
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find ./*/filename.txt -type f -exec grep -l <span class="s2">&quot;text to find&quot;</span> <span class="o">{}</span> + </span></pre></div> </td></tr></table>
"find text in file", bash