snipt

Ctrl+h for KB shortcuts

Text only

Colored Tail

1
2
3
4
5
6
7
INFO - GRÜN				s/.*\b(INFO)\b.*/\e[1;32;40m$&\e[0m/g
WARNING - GELB			s/.*\b(WARN|WARNING)\b.*/\e[1;33;40m$&\e[0m/g
ERROR|FATAL - ROT		s/.*\b(ERROR|FATAL)\b.*/\e[1;31;40m$&\e[0m/g	
SEVERE - MAGENTA		s/.*\b(SEVERE)\b.*/\e[1;35;40m$&\e[0m/g			
DEBUG - BLAU			s/.*\b(DEBUG)\b.*/\e[1;36;40m$&\e[0m/g

tail -f catalina.out | perl -pe 's/.*\b(INFO)\b.*/\e[0;32;40m$&\e[0m/g,s/.*\b(WARN)\b.*/\e[0;33;40m$&\e[0m/g,s/.*\b(ERROR|FATAL)\b.*/\e[0;31;40m$&\e[0m/g,s/.*\b(SEVERE)\b.*/\e[1;35;40m$&\e[0m/g,s/.*\b(DEBUG)\b.*/\e[0;31;40m$&\e[0m/g'
https://snipt.net/embed/ff5ef0fbc694367ae4ccc849cac816e9/
https://snipt.net/raw/ff5ef0fbc694367ae4ccc849cac816e9/
ff5ef0fbc694367ae4ccc849cac816e9
text
Text only
7
2016-09-27T08:14:53
True
False
False
/api/public/snipt/98678/
colored-tail
<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 id="L-1"><a name="L-1"></a>INFO - GRÜN s/.*\b(INFO)\b.*/\e[1;32;40m$&amp;\e[0m/g </span><span id="L-2"><a name="L-2"></a>WARNING - GELB s/.*\b(WARN|WARNING)\b.*/\e[1;33;40m$&amp;\e[0m/g </span><span id="L-3"><a name="L-3"></a>ERROR|FATAL - ROT s/.*\b(ERROR|FATAL)\b.*/\e[1;31;40m$&amp;\e[0m/g </span><span id="L-4"><a name="L-4"></a>SEVERE - MAGENTA s/.*\b(SEVERE)\b.*/\e[1;35;40m$&amp;\e[0m/g </span><span id="L-5"><a name="L-5"></a>DEBUG - BLAU s/.*\b(DEBUG)\b.*/\e[1;36;40m$&amp;\e[0m/g </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>tail -f catalina.out | perl -pe &#39;s/.*\b(INFO)\b.*/\e[0;32;40m$&amp;\e[0m/g,s/.*\b(WARN)\b.*/\e[0;33;40m$&amp;\e[0m/g,s/.*\b(ERROR|FATAL)\b.*/\e[0;31;40m$&amp;\e[0m/g,s/.*\b(SEVERE)\b.*/\e[1;35;40m$&amp;\e[0m/g,s/.*\b(DEBUG)\b.*/\e[0;31;40m$&amp;\e[0m/g&#39; </span></pre></div> </td></tr></table>
colored, perl, tail

Shell Session

perl convert dos to unix

perl -pi -e 's/\r\n|\n|\r/\r\n/g' file-to-convert  # Convert to DOS
perl -pi -e 's/\r\n|\n|\r/\n/g'   file-to-convert  # Convert to UNIX
https://snipt.net/embed/549871ea3347ad2dd3783eaf8305470e/
https://snipt.net/raw/549871ea3347ad2dd3783eaf8305470e/
549871ea3347ad2dd3783eaf8305470e
shell-session
Shell Session
3
2016-09-26T18:46:17
True
False
False
May 24, 2013 at 03:31 PM
/api/public/snipt/62165/
perl-convert-dos-to-unix
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="go">perl -pi -e &#39;s/\r\n|\n|\r/\r\n/g&#39; file-to-convert # Convert to DOS</span> </span><span id="L-2"><a name="L-2"></a><span class="go">perl -pi -e &#39;s/\r\n|\n|\r/\n/g&#39; file-to-convert # Convert to UNIX</span> </span></pre></div> </td></tr></table>
convert, csv, dos, perl, unix

Perl

GetTodaysDate()

1
2
3
4
sub GetTodaysDate ()
{
	return sprintf ("%04d-%02d-%02d", (((localtime (time ()))[5]) + 1900), (((localtime (time ()))[4]) + 1), ((localtime (time ()))[3]));
}
https://snipt.net/embed/0e71fe4c31039f246d8e061ff9aed22f/
https://snipt.net/raw/0e71fe4c31039f246d8e061ff9aed22f/
0e71fe4c31039f246d8e061ff9aed22f
perl
Perl
4
2016-09-27T05:57:14
True
False
False
/api/public/snipt/30040/
gettodaysdate
<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 id="L-1"><a name="L-1"></a><span class="k">sub </span><span class="nf">GetTodaysDate</span> <span class="p">()</span> </span><span id="L-2"><a name="L-2"></a><span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="nb">sprintf</span> <span class="p">(</span><span class="s">&quot;%04d-%02d-%02d&quot;</span><span class="p">,</span> <span class="p">(((</span><span class="nb">localtime</span> <span class="p">(</span><span class="nb">time</span> <span class="p">()))[</span><span class="mi">5</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1900</span><span class="p">),</span> <span class="p">(((</span><span class="nb">localtime</span> <span class="p">(</span><span class="nb">time</span> <span class="p">()))[</span><span class="mi">4</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="p">((</span><span class="nb">localtime</span> <span class="p">(</span><span class="nb">time</span> <span class="p">()))[</span><span class="mi">3</span><span class="p">]));</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
perl
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.