Page 1 of 2

Can I output a simple text file of lines which are different

Posted: Tue Jun 15, 2004 3:31 pm
by kevinshowell
I am comparing two files and would like to produce an output file that is a simple text file containing the lines from file 1 which are different from file2.

Is this possible?
Is it possible to do this for all files in two directories which contain identically named files.?
Ideally I would like to be able to do this from a command line with no further interaction being required.

Is any of the above possible?

Posted: Tue Jun 15, 2004 5:21 pm
by psguru
Yes, it is possible. Use /o option to produce a diff output for 2 files. Use /f option along with /o option to produce a diff report for 2 directories that also includes file diffs.

Posted: Tue Jun 15, 2004 10:34 pm
by kevinshowell
I must obviously be doing something wrong, or we are talking at cross purposes. If I use just the /o option is does indeed produce a text file, but this is a unix style diff report rather than a file which contains just the lines from file 1.

e.g. the comparision produces
6,7c6,7
< Angel,George Henry D,Plympton,5b,363
< Angel,Maurice,Marylebone,1a,997
---
> Angel,George Henry D,Plympton St M,5b,*63
> Angel,Maurice,Marylebone,1a,**7

but I would like it to produce just
Angel,George Henry D,Plympton,5b,363
Angel,Maurice,Marylebone,1a,997

Is this possible?
Thanks in advance.
Kevin.

Posted: Wed Jun 16, 2004 5:31 am
by psguru
I thought you meant Unix diff format. No, what you need is not directly possible. You could write, say, a Perl script to process EDPro's output and get what you need.

Posted: Tue Jul 06, 2004 4:54 am
by Farrillaga
I've found a possible solution. I can choose 'Use Filter View' in order to see only the differences. Select all the text of the first pannel, copy the selected text and paste-it on the Notepad. Only the differences are shown. At last, save the notepad content.

Posted: Tue Jul 06, 2004 5:55 am
by psguru
This will work from the GUI. However, the original poster wanted to save such diff-only file from the command line...

Posted: Tue Jul 13, 2004 4:47 am
by CountZero
If you use such tools like the GNU unix tools for windows from http://unxutils.sourceforge.net/
you may add to your script something like this:

set DIFF_FILE=diff.txt

REM comp (whatever)
examdiff a b /o:%DIFF_FILE%

REM get rid of identical files
grep -v "^Identical files" %DIFF_FILE% > NOT_IDENTICAL_FILES.TXT

by using grep with -v it will copy all lines not beginning with Identical files to the new file: NOT_IDENTICAL_FILES.TXT

Did I understand your question correct?

Posted: Tue Jul 13, 2004 5:32 pm
by psguru
Yes, you could do that. Or use View Filter in EDPro to only output non-identical file. The original problem, however, was to related to file, not directory, comparison.

Posted: Sun Aug 27, 2006 2:56 pm
by sn00p
Since it has been over 2 years from when this question was asked, I thought I would bring it back up. The only thing I need is a prog that can compare 2 text files and output another text file with just the lines that are different, and do this from the command line so I can script it.

Can the latest version do this?

Regards,

Craig

Posted: Sun Aug 27, 2006 3:27 pm
by psguru
No, this is still not possible without additional scripting. To be honest, this feature hasn't been on our priority list since it's not requested by many users.

Posted: Sun Aug 27, 2006 3:47 pm
by sn00p
I understand. However, this is the first program that I have found that can actually display just the differences in 2 files. The let down is that it cannot be saved so I have to copy and paste the results into 26 individual files every time I use it.

I'm not much of a programmer so I have no idea what is required to go from display to text file output. I'll keep checking back to see if this ever makes it into the program. Thanks!

- Craig

Posted: Sun Aug 27, 2006 4:21 pm
by psguru
Well, perhaps you could provide an example of what you are looking for. It's possible that your particular need has already been covered by the current implementation of ExamDiff Pro.

Posted: Sun Aug 27, 2006 4:55 pm
by sn00p
Basically, I have 26 pairs of text files, the old versions and the new versions in seperate directories. They are just rows of data like the following example:

id,eid,empstatus,6,6,Y,N,Y,Y,,,,,

What I want is to be able to compare each pair of files and output only the lines that differ in a 3rd text file. Also, I would like to be able to do this from the command line so that I can run one batch file and process all 26 pairs of files.

Let me know if I have left out any important details.

Thanks!

- Craig

Posted: Sun Aug 27, 2006 6:17 pm
by psguru
Have you tried /o option? The result will be something like

1,2d0
< Line 1 from the first file
< Line 2 from the first file
4c2
< Line 4 from the first file
---
> Line 2 from the first file

simple output diff text

Posted: Thu Nov 02, 2006 4:23 pm
by davidla
Hi,
I was planning to use your program to compare to two 50MB .csv files (yesterday and todays) which are uploaded to a website via FTP each night. I thought it was about time to only upload the differences. Alas it seems I can output the difference but you apend it with information which I then would have to strip out. I note your comments that no one has asked for this function, but think for a minute, if you provide a visual presentation of the information in your GUI, why would anyone need the information repeated in the diff output file, the very information invalidates it!
You would only need the physical diff file if you wanted to do something with it, wouldn't you? You could prepare a totally separate report with the information you currently put in the diff file, if needed.

If you ever put the (obviously needed) option in to your program to obtain a diff file, please email me and alert me because I will likely buy it; meantime I'll go shopping for one that does.

David