snipt

Ctrl+h for KB shortcuts

Text only

Tail and Highlight keyworks

tail -f file | perl -pe 's/keyword/\e[1;31;43m$&\e[0m/g'

This only works on ANSI terminals, but all others have become virtually
extinct. \e[...m ist the ANSI escape sequence SGR "select graphic
rendition". The "..." can be replaced by some semicolon-separated
integers, with the meaning:

0 : all attributes off
1 : bold
31 : foreground red
43 : background yellow
https://snipt.net/embed/8be9e2bf566a040101d14691a0c8f087/
/raw/8be9e2bf566a040101d14691a0c8f087/
8be9e2bf566a040101d14691a0c8f087
text
Text only
11
2019-07-21T13:06:32
True
False
False
May 07, 2013 at 09:01 PM
/api/public/snipt/60888/
tail-and-highlight-keyworks
<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> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>tail -f file | perl -pe &#39;s/keyword/\e[1;31;43m$&amp;\e[0m/g&#39; </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>This only works on ANSI terminals, but all others have become virtually </span><span id="L-4"><a name="L-4"></a>extinct. \e[...m ist the ANSI escape sequence SGR &quot;select graphic </span><span id="L-5"><a name="L-5"></a>rendition&quot;. The &quot;...&quot; can be replaced by some semicolon-separated </span><span id="L-6"><a name="L-6"></a>integers, with the meaning: </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a>0 : all attributes off </span><span id="L-9"><a name="L-9"></a>1 : bold </span><span id="L-10"><a name="L-10"></a>31 : foreground red </span><span id="L-11"><a name="L-11"></a>43 : background yellow </span></pre></div> </td></tr></table>