ahm*_*mex 4 python emacs bash grep text
如何根据原始文本计算两个文本文件之间的交集?解决方案是使用shell命令还是用Python,Elisp或其他常用脚本语言表达并不重要.
我知道comm
和grep -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.