Liuw's Thinkpad

想要赢就先学会输,想要成功就先学会失败

Archive for the ‘comm’ tag

Shell实现求两个文件中不同行的行数

with 2 comments

小胖提到的一个问题:有两个已经排序好的URL文件a和b,想要求出b中与a不同的行数。

太久没有写Shell了,还想了一阵用哪个命令好。

expr `wc -l b` - `comm -1 -2 a b | wc -l`

有更好的方法请指教。

Written by liuw

May 8th, 2010 at 11:18 pm

Posted in UNIX-like

Tagged with ,