利用两个现存文件,合并成一个新的文件

1. 取出两个文件的并集(重复的行只保留一份)
  cat file1 file2 | sort | uniq


2. 取出两个文件的交集(只留下同时存在于两个文件中的文件)
  cat file1 file2 | sort | uniq -d


3. 删除交集,留下其他的行
  cat file1 file2 | sort | uniq –u

posted @ 2011-06-09 23:42  范宇超  阅读(315)  评论(0编辑  收藏  举报