作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一系列文本文件,我想知道它们之间的共同行而不是不同行。命令行 Unix 或 Windows 都可以。
文件foo:
linux-vdso.so.1 => (0x00007fffccffe000)
libvlc.so.2 => /usr/lib/libvlc.so.2 (0x00007f0dc4b0b000)
libvlccore.so.0 => /usr/lib/libvlccore.so.0 (0x00007f0dc483f000)
libc.so.6 => /lib/libc.so.6 (0x00007f0dc44cd000)
文件栏:
libkdeui.so.5 => /usr/lib/libkdeui.so.5 (0x00007f716ae22000)
libkio.so.5 => /usr/lib/libkio.so.5 (0x00007f716a96d000)
linux-vdso.so.1 => (0x00007fffccffe000)
因此,鉴于上面这两个文件,所需实用程序的输出将类似于 file1:line_number, file2:line_number == 匹配文本
(只是一个建议;我真的不在乎语法是什么):
foo:1, bar:3 == linux-vdso.so.1 => (0x00007fffccffe000)
最佳答案
在 *nix 上,您可以使用 comm 。问题答案是:
comm -1 -2 file1.sorted file2.sorted
# where file1 and file2 are sorted and piped into *.sorted
以下是comm
的完整用法:
comm [-1] [-2] [-3 ] file1 file2
-1 Suppress the output column of lines unique to file1.
-2 Suppress the output column of lines unique to file2.
-3 Suppress the output column of lines duplicated in file1 and file2.
另请注意,如手册页中所述,在使用 comm 之前对文件进行排序非常重要。
关于command-line - 如何显示共同点(反向差异)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/746458/
用于 Java 的 not-yet-commons SLL 包提供了一个 OpenSSL 对象和一个基于密码的加密方法: 加密(“des”,密码,数据); 据说此方法与 OpenSSL C 库兼容。我
我是一名优秀的程序员,十分优秀!