snipt

Ctrl+h for KB shortcuts

Bash

Recursive Convert Leading Tabs to Spaces

for i in $(find . -name '*.php'); do expand -i --tabs=2 $i >$i.tmp && mv -f $i.tmp $i; done
https://snipt.net/embed/78718217bbc080b77faf7e27b1538d9d/
/raw/78718217bbc080b77faf7e27b1538d9d/
78718217bbc080b77faf7e27b1538d9d
bash
Bash
1
2019-06-24T19:36:21
True
False
False
/api/public/snipt/41449/
recursive-convert-leading-tabs-to-spaces
<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><span class="k">for</span> i in <span class="k">$(</span>find . -name <span class="s1">&#39;*.php&#39;</span><span class="k">)</span><span class="p">;</span> <span class="k">do</span> expand -i --tabs<span class="o">=</span><span class="m">2</span> <span class="nv">$i</span> &gt;<span class="nv">$i</span>.tmp <span class="o">&amp;&amp;</span> mv -f <span class="nv">$i</span>.tmp <span class="nv">$i</span><span class="p">;</span> <span class="k">done</span> </span></pre></div> </td></tr></table>
indent, shell, spaces, tabs