获取两个站点的格式化输出(这里我们使用w3m,但lynx也可以工作):
\n\nw3m -dump http://google.com 2>/dev/null > /tmp/1.html\nw3m -dump http://google.de 2>/dev/null > /tmp/2.html\nRun Code Online (Sandbox Code Playgroud)\n\n然后使用wdiff,它可以为您提供两个文本相似程度的百分比。
\n\nwdiff -nis /tmp/1.html /tmp/2.html\nRun Code Online (Sandbox Code Playgroud)\n\n使用colordiff也可以更容易地看到差异。
\n\nwdiff -nis /tmp/1.html /tmp/2.html | colordiff\nRun Code Online (Sandbox Code Playgroud)\n\n输出摘录:
\n\nWeb Images Vid\xc3\xa9os Maps [-Actualit\xc3\xa9s-] Livres {+Traduction+} Gmail plus \xc2\xbb\n[-iGoogle |-]\nParam\xc3\xa8tres | Connexion\n\n Google [hp1] [hp2]\n [hp3] [-Fran\xc3\xa7ais-] {+Deutschland+}\n\n [ ] Recherche\n avanc\xc3\xa9eOutils\n [Recherche Google][J\'ai de la chance] linguistiques\n\n\n/tmp/1.html: 43 words 39 90% common 3 6% deleted 1 2% changed\n/tmp/2.html: 49 words 39 79% common 9 18% inserted 1 2% changed\nRun Code Online (Sandbox Code Playgroud)\n\n(他实际上把 google.com 变成了法语......有趣)
\n\n常见的%值是两个文本的相似程度。另外,您可以轻松地按单词查看差异(而不是按行查看,因为行可能会造成混乱)。
\n| 归档时间: |
|
| 查看次数: |
3437 次 |
| 最近记录: |