Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Iterate number in Jade

1
2
3
4
- for (var i = 1; i <= 14; ++i) {
.card
	img(src='img/presentations/blog/#{i}.jpg')
- }
https://snipt.net/embed/384393f571c262216676fc27f35f0ada/
https://snipt.net/raw/384393f571c262216676fc27f35f0ada/
384393f571c262216676fc27f35f0ada
text
Text only
4
2016-11-07T13:24:36
True
False
True
Dec 29, 2013 at 08:10 AM
/api/public/snipt/102889/
iterate-number-in-jade
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>- for (var i = 1; i &lt;= 14; ++i) { </span><span id="L-2"><a name="L-2"></a>.card </span><span id="L-3"><a name="L-3"></a> img(src=&#39;img/presentations/blog/#{i}.jpg&#39;) </span><span id="L-4"><a name="L-4"></a>- } </span></pre></div> </td></tr></table>
each, for, jade

Bash

Bulk rename a lot of files removing all the occurrences of a specific string in their names

1
2
3
4
5
6
7
# Bulk rename a lot of files removing all the occurrences of a specific string in their names

# Example:
#     foo_1.jpg ---> 1.jpg
#     foo_AAA.pdf ---> AAA.pdf

for i in foo_*; do mv $i ${i/foo_/}; done
https://snipt.net/embed/23564cc60db7c0f3e62faed5efa2bdc5/
https://snipt.net/raw/23564cc60db7c0f3e62faed5efa2bdc5/
23564cc60db7c0f3e62faed5efa2bdc5
bash
Bash
7
2016-12-09T06:08:50
True
False
False
/api/public/snipt/66215/
-5176
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Bulk rename a lot of files removing all the occurrences of a specific string in their names</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># Example:</span> </span><span id="L-4"><a name="L-4"></a><span class="c1"># foo_1.jpg ---&gt; 1.jpg</span> </span><span id="L-5"><a name="L-5"></a><span class="c1"># foo_AAA.pdf ---&gt; AAA.pdf</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="k">for</span> i in foo_*<span class="p">;</span> <span class="k">do</span> mv <span class="nv">$i</span> <span class="si">${</span><span class="nv">i</span><span class="p">/foo_/</span><span class="si">}</span><span class="p">;</span> <span class="k">done</span> </span></pre></div> </td></tr></table>
bash, for, mv, rename
Copyrighted, illegal, or inappropriate content? Email [email protected].