Difference between two text files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
vicky_ag
Posts: 6
Joined: 08 Dec 2014 06:16

Difference between two text files

#1 Post by vicky_ag » 10 Jan 2015 04:55

I am generating output from a system which writes to a text file in this format:

Code: Select all

                           Headline   Headline   Headline   
                          Headline2     Headline2   Headline2
Describe11   Describe21   Describe31      100          200         300
                                Describe32     200         400          500
                                Describe33     700         800          650
                                Describe34     467         445          245
Describe12   Describe22   Describe31      100          200         300
                                Describe32     200         400          500
                                Describe33     700         800          650
                                Describe34     467         445          245


Spacing is tab delimited.

I have to compare two files with similar format and write a log if there were any differences. I was able to achieve it using fc command:

Code: Select all

fc 1.txt 2.txt > log.txt

Two additional conditions were added, write to log only if:
a. Differences in numbers (under Headline2, Headline3, Headline4) is more than 0.0001
b. Left most description is not "Describe12". So if it is Describe11, the log should be written

Is this doable using batch or powershell?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Difference between two text files

#2 Post by foxidrive » 10 Jan 2015 10:33

See here for some pointers: viewtopic.php?f=3&t=6108

Post Reply