Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to quickly compare files in two different directories to see if the files are the same (same content). I want to see the results in Kompare (I'm on KDE - Kubuntu 12.04).

Here's my diff command:

diff -EwbBsy /directory/one /directory/two

(That command would suit me even better if it ignored any files in /directory/one that are not already present in /directory/two, but I couldn't figure out how to achieve that.)

To use Kompare, I do this:

diff -EwbBsy /directory/one /directory/two | kompare -o -

However, that gives the following error:

Error: Could not parse diff output.

I also tried:

diff -Ewbus /directory/one /directory/two | kompare -o -

and just

diff /directory/one /directory/two | kompare -o -

and a few other variations without success. What am I doing wrong? Thanks.

share|improve this question
    
Are you opposed to using kdiff3 instead of kompare? –  slm Jul 16 '13 at 1:36
    
I'm not opposed to kdiff3, but it isn't installed by default and kompare is installed. –  MountainX Jul 16 '13 at 1:58
    
It's a KDE app, but yes, you'd have to install it. Is that an option? –  slm Jul 16 '13 at 2:09
    
Your comparing all the files in dir one with dir two, or is the one and the two files? –  slm Jul 16 '13 at 2:10
    
@slm Yes I am comparing all the files in dir one with dir two. Normally, it would compare fileA in dir/one with fileA in dir/two, then do the same with fileB, fileC, etc. –  MountainX Jul 16 '13 at 3:49

1 Answer 1

up vote 2 down vote accepted

It doesn't seem to be able to handle the -y switch which does the side-by-side style of diff, but you can use the unified diff (-u). You can't mix these 2 styles so it's either -y or -u. So doing this worked for me:

$ diff -EwbBsu /directory/one /directory/two | kompare -o -

This will not show the entire file with the matches, just the line that was different, with 3 lines of context, by default. If you want more context you can provide -u a argument of a number (u 10) for example.

$ diff -EwbBsU 10 /directory/one /directory/two | kompare -o -
share|improve this answer
    
That's strange. I still get the same error with your command Could not parse diff output. Maybe my problem is with kompare. However, kompare works fine in normal GUI usage. –  MountainX Jul 16 '13 at 1:49
    
@MountainX - it works fine in normal for me as well. What version are you using? kompare --version Qt: 4.7.4 KDE Development Platform: 4.6.5 (4.6.5) Kompare: 4.0.0. –  slm Jul 16 '13 at 2:07
    
kompare --version Qt: 4.8.1 KDE Development Platform: 4.8.5 (4.8.5) Kompare: 4.1.2 –  MountainX Jul 16 '13 at 2:42
    
@MountainX - What's the distro? –  slm Jul 16 '13 at 2:44
    
Kubuntu 12.04 LTS –  MountainX Jul 16 '13 at 3:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.