语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -8,9 +8,9 @@
<li>差集:打印出包含在一个文件中,但不包含在其他指定文件中的行。</li>
</ul>
<h3 id="语法">语法</h3>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="fu">comm</span> [选项]... 文件1 文件2</a></code></pre></div>
<div class="sourceCode" id="cb1"><pre><code class="language-bash"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="fu">comm</span> [选项]... 文件1 文件2</a></code></pre></div>
<h3 id="选项">选项</h3>
<pre><code>如果不附带选项,程序会生成三列输出。
<pre><code class="language-bash">如果不附带选项,程序会生成三列输出。
第一列包含文件1 特有的行,
第二列包含文件2 特有的行,
而第三列包含两个文件共有的行。
@@ -29,7 +29,7 @@
</ul>
<h3 id="实例">实例</h3>
<p>文本 <code>aaa.txt</code> 内容</p>
<pre><code>[root@localhost text]# cat aaa.txt
<pre><code class="language-bash">[root@localhost text]# cat aaa.txt
aaa
bbb
ccc
@@ -38,7 +38,7 @@ eee
111
222</code></pre>
<p>文本 <code>bbb.txt</code> 内容</p>
<pre><code>[root@localhost text]# cat bbb.txt
<pre><code class="language-bash">[root@localhost text]# cat bbb.txt
bbb
ccc
aaa
@@ -46,10 +46,10 @@ hhh
ttt
jjj</code></pre>
<p>两个文件之间的比较,如果没有排序需要带上<code>--nocheck-order</code>参数, 没有带上参数将会收到提示,此命令重要之功能在于比较。</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="ex">comm</span>: 文件2 没有被正确排序</a>
<div class="sourceCode" id="cb5"><pre><code class="language-bash"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="ex">comm</span>: 文件2 没有被正确排序</a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="ex">comm</span>: 文件1 没有被正确排序</a></code></pre></div>
<p>比较结果</p>
<pre><code>[root@localhost text]# comm --nocheck-order aaa.txt bbb.txt
<pre><code class="language-bash">[root@localhost text]# comm --nocheck-order aaa.txt bbb.txt
aaa
bbb
ccc
@@ -65,10 +65,10 @@ eee
<p>输出的第一列只包含在aaa.txt中出现的行第二列包含在bbb.txt中出现的行第三列包含在aaa.txt和bbb.txt中相同的行。各列是以制表符作为定界符。</p>
<h3 id="有序比较">有序比较</h3>
<p>有序比较,先通过 sort 将文件内容排序</p>
<pre><code>[root@localhost ~]# sort aaa.txt &gt; aaa1.txt
<pre><code class="language-bash">[root@localhost ~]# sort aaa.txt &gt; aaa1.txt
[root@localhost ~]# sort bbb.txt &gt; bbb1.txt</code></pre>
<p>有序比较结果:</p>
<pre><code>[root@localhost ~]# comm aaa1.txt bbb1.txt
<pre><code class="language-bash">[root@localhost ~]# comm aaa1.txt bbb1.txt
111
222
aaa
@@ -81,12 +81,12 @@ eee
ttt</code></pre>
<h3 id="交集">交集</h3>
<p>打印两个文件的交集,需要删除第一列和第二列:</p>
<pre><code>[root@localhost text]# comm aaa.txt bbb.txt -1 -2
<pre><code class="language-bash">[root@localhost text]# comm aaa.txt bbb.txt -1 -2
bbb
ccc</code></pre>
<p><strong>求差</strong></p>
<p>打印出两个文件中不相同的行,需要删除第三列:</p>
<pre><code>[root@localhost text]# comm aaa.txt bbb.txt -3 | sed &#39;s/^\t//&#39;
<pre><code class="language-bash">[root@localhost text]# comm aaa.txt bbb.txt -3 | sed &#39;s/^\t//&#39;
aaa
aaa
ddd
@@ -100,14 +100,14 @@ jjj</code></pre>
<h3 id="差集">差集</h3>
<p>通过删除不需要的列可以得到aaa.txt和bbb.txt的差集</p>
<p>aaa.txt的差集</p>
<pre><code>[root@localhost text]# comm aaa.txt bbb.txt -2 -3
<pre><code class="language-bash">[root@localhost text]# comm aaa.txt bbb.txt -2 -3
aaa
ddd
eee
111
222</code></pre>
<p>bbb.txt的差集</p>
<pre><code>[root@localhost text]# comm aaa.txt bbb.txt -1 -3
<pre><code class="language-bash">[root@localhost text]# comm aaa.txt bbb.txt -1 -3
aaa
hhh
ttt