.bat file to compare two text files and output the difference

前端 未结 3 1678
陌清茗
陌清茗 2020-12-10 16:27

I am trying something new that I have done on UNIX successfully but have no idea how to do on windows.

So I save a text file, let\'s say test1.txt and 12 hours later

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 17:25

    The Simplest and fastest method is using findstr command it will compare and return the result to new file here the script

    findstr /vixg:Z:\misc\test1.txt Z:\misc\misc\test2.txt > Z:\misc\misc\test3.txt
    
    
    findstr /vixg:  > outputfile
    

    here

    /v   : Prints only lines that do not contain a match.
    /i   : Specifies that the search is not to be case-sensitive.
    /x   : Prints lines that match exactly.
    /g: file   : Gets search strings from the specified file.
    

提交回复
热议问题