说明:蓝色=命令名称html
浅绿=命令参数ide
浅蓝=选项学习
紫色=目录spa
系统环境:Arch Linux x86_64orm
awk版本: GNU Awk 4.1.0htm
没有系统的学习过awk相关应用,一直觉得RS不支持正则,今天无聊尝试了一下,原来RS正则用起来也挺犀利的。blog
内容以下:get
<pre id="help-1"><b>-l</b> use a long listing format</pre> </td> </tr><tr> <td> <pre id="help-2"><b>-a</b>, <b>--all</b> do not ignore entries starting with .</pre> </td> </tr> </tbody> </table> </div> <div style="height: 5px;"></div> <div style="height: 100px;"></div> <div> <table id="help" width="100%"> <tbody> <tr> <td> <pre id="help-0">list directory contents</pre> </td> </tr><tr> <td>
想获得以下内容:it
<b>-l</b> use a long listing format <b>-a</b>, <b>--all</b> do not ignore entries starting with . list directory contents
awk语句:awk 'BEGIN{RS="</?pre[^>]*>"}!(NR%2)' filetable