70599
V2EX  ›  问与答

linux 环境下,合并文本文档的问题。

  •  
  •   70599 · Jan 15, 2015 · 2268 views
    This topic created in 4179 days ago, the information mentioned may be changed or developed.

    1、Linux环境。
    2、有A.txt和B.txt。
    3、两者有的行是一样的,有的行不一样。

    怎样合并二者,并且让合并后的文件中没有重复的行?

    3 replies    2015-01-15 15:32:29 +08:00
    fising
        1
    fising  
       Jan 15, 2015
    join uniq
    lifanxi
        2
    lifanxi  
       Jan 15, 2015   ❤️ 1
    不再乎行的顺序的话,cat a.txt b.txt | sort -u > c.txt
    70599
        3
    70599  
    OP
       Jan 15, 2015
    @lifanxi 够用了,谢谢。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4290 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:16 · PVG 08:16 · LAX 17:16 · JFK 20:16
    ♥ Do have faith in what you're doing.