小编ahm*_*mex的帖子

文本文件之间的交叉点

如何根据原始文本计算两个文本文件之间的交集?解决方案是使用shell命令还是用Python,Elisp或其他常用脚本语言表达并不重要.

我知道commgrep -Fxv -f file1 file2.两者都假设我对线的交叉感兴趣,而我对字符的交集感兴趣(在计算匹配所需的字符数上最少).

奖励点为效率.

如果文件1包含

foo bar baz-fee
Run Code Online (Sandbox Code Playgroud)

和文件2包含

fee foo bar-faa
Run Code Online (Sandbox Code Playgroud)

那我想看看

  • foo bar
  • fee

假设最小匹配长度为3.

python emacs bash grep text

4
推荐指数
1
解决办法
1078
查看次数

标签 统计

bash ×1

emacs ×1

grep ×1

python ×1

text ×1