snipt

Ctrl+h for KB shortcuts

Bash

AWK timestamp each line

<cmd> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
https://snipt.net/embed/3c95a0173f04f01070d3df97f8aa825b/
/raw/3c95a0173f04f01070d3df97f8aa825b/
3c95a0173f04f01070d3df97f8aa825b
bash
Bash
1
2019-08-25T17:16:59
True
False
False
Mar 25, 2016 at 06:05 PM
/api/public/snipt/144950/
awk-timestamp-each-line
<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>&lt;cmd&gt; <span class="p">|</span> awk <span class="s1">&#39;{ print strftime(&quot;%Y-%m-%d %H:%M:%S&quot;), $0; fflush(); }&#39;</span> </span></pre></div> </td></tr></table>
awk, bash, console, timestamp
1
2
3
4
--- 
+++ 
@@ -0,0 +1 @@
+<cmd> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'