瞭解sort和uniq命令(包括uniq的-u和-d選項)

來源:互聯網
上載者:User

瞭解sort和uniq命令(包括uniq的-u和-d選項) [plain] cat a b | sort | uniq > c   # c is a union b 並集     cat a b | sort | uniq -d > c   # c is a intersect b 交集     cat a b b | sort | uniq -u > c   # c is set difference a - b 差集  查看a b檔案內容  [root@hadoop luanshoushen]# cat a b  LUAN  SHOU  SHEN  LUAN  SHOU  SHEN  1111  2222  3333  LUAN  KEVIN  1234  1111  使用-c  cat a b |sort|uniq -c        2 1111        1 1234        1 2222        1 3333        1 KEVIN        3 LUAN        2 SHEN        2 SHOU  cat a b |sort|uniq //並集  1111  1234  2222  3333  KEVIN  LUAN  SHEN  SHOU   cat a b |sort|uniq -d //交集  1111  LUAN  SHEN  SHOU   cat a b |sort|uniq  -u //差集  1234  2222  3333  KEVIN   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.