This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>这个手册是我转载的,准备用markdown整理下格式,感觉原来的html太乱了。</p> | |
<p>TOC是通过python的markdown生成的,<a href="http://www.freewisdom.org/projects/python-markdown/">http://www.freewisdom.org/projects/python-markdown/</a></p> | |
<pre><code>markdown awk.md > awk.html -x toc | |
</code></pre> | |
<p>以下全部内容是从 <a href="http://linuxfire.com.cn/~lily/awk.html">http://linuxfire.com.cn/~lily/awk.html</a> 转载的。</p> | |
<div id="awktoc"> | |
<div class="toc"> | |
<ul> | |
<li><a href="#awk">awk 手册</a><ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# awk 支持直接比较时间字符串,并通过 ~ match表达式匹配包含字符串 | |
awk '$1>="2018-08-17"&&$2>"09:55:20"&&$0 ~ /installed memtester/ {print $0}' /var/log/dpkg.log | |
# 输出是: 2018-08-17 09:55:30 status installed memtester:amd64 4.3.0-3 | |
# 如果需要持续监控日志文件,可以使用 tail -1f 持续的输出最后一行,并通过 | pipe 交给awk 处理, exit 表示在匹配到一次后退出 | |
tail -f /var/log/dpkg.log | awk '$1>="2018-08-17"&&$2>"09:55:20"&&$0 ~ /installed memtester/ {print $0; exit}' | |
# 可通过 tail -Nf (N 为行数)来指定从倒数第几行开始扫描 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"alignment_chars" : ["=", ":"] | |
} |