Liuw's Thinkpad

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

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

with 2 comments

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

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

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

有更好的方法请指教。

© 2010, liuw. All rights reserved.

Written by liuw

May 8th, 2010 at 11:18 pm

Posted in UNIX-like

Tagged with ,

2 Responses to 'Shell实现求两个文件中不同行的行数'

Subscribe to comments with RSS or TrackBack to 'Shell实现求两个文件中不同行的行数'.

  1. 用diff行不?

      (Quote)

    wayne

    9 May 10 at 09:33

  2. @wayne
    diff没有找到直接可用的参数。

      (Quote)

    liuw

    9 May 10 at 09:41

Leave a Reply

*