Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
hello guys. im kind of embarrassed for asking this, but its driving me nuts.
im trying to compare two files with vimdiff, and vimdiff places a lot of hiffens ( i think it means that its because these lines doesnt appear on the other file ) but the thing is : the files are too simple to have this problem.
im not sure if i made myself clear, so ill post my results:
sorry for such a question, and yes, i know, i could just compare them manually, but ill need vimdiff for larger files. these are just some tests, and they are causing me trouble. thx
in case someone is wondering, here is the output of diff:
diff is mostly a line oriented comparison. In this case it sees the line containing only "5" and tries to line them up in both files. Having lined those up, the hyphens represent non-existent lines before one file and after the other.
It doesn't simply compare line 1 with line 1 etc because it needs to be able to detect where lines have been added or deleted.
The first and second line can be interpreted as existing only in the second file. The third line is the same in both. Fourth is a modified line. Last two lines exist only in the first file.
Basically, these files are too simple for diff to work out what to do with them.
I have never used xxdiff so can't say if it would produce better output.
diff is mostly a line oriented comparison. In this case it sees the line containing only "5" and tries to line them up in both files. Having lined those up, the hyphens represent non-existent lines before one file and after the other.
It doesn't simply compare line 1 with line 1 etc because it needs to be able to detect where lines have been added or deleted.
The first and second line can be interpreted as existing only in the second file. The third line is the same in both. Fourth is a modified line. Last two lines exist only in the first file.
Basically, these files are too simple for diff to work out what to do with them.
I have never used xxdiff so can't say if it would produce better output.
thx for the explanation. is there a way to disable this feature, or another utility program that only compares line per line?
If all the lines are different, as shown in your example, I don't think that vimdiff, or some other diff program, is the right way to cope with your problem.
Be more clear about what may differ in the files you want to compare, and about what you want the comparison for.
What do you intend to do ?
If all the lines are different, as shown in your example, I don't think that vimdiff, or some other diff program, is the right way to cope with your problem.
Be more clear about what may differ in the files you want to compare, and about what you want the comparison for.
What do you intend to do ?
not all lines are different. only some of them. i need to comapre the output of my programs with the correct output. like i said, this example is silly.
Quote:
Just fyi hiffens => hyphens ; your spelling threw me for a minute there
don't remember very well, but i think i used the spell check b4 posting.
Or provide more precise example of the contents of the files.
sorry for the delay in my response. i tried pr and sed, but they show equal lines as well. i'll try to clarify my needs again.
basically, what i want is a program that compares line per line. if ith line from file1 differs from ith line from file2, print i(the line number, so i cant check them).
i checked a little bit the internet, and i found cmp and comm, but these don't do exactly what i want. cmp print differing bytes, and comm needs the lines to be sorted. like Vrajgh, diff doesn't work because it's a utility that is used mostly to compare the same file, but from different versions, with some modifications; it does this to generate a patch. diff works for some of my files, given their size and relatively small number of differences, but fails in the examples i gave. still, i'd like to have something that works always for my files.
the program i want is easy to implement, but i need to check files not only in my pc, so i was looking for some program that comes in most linux distros. sed seems to be enough, but i don't know how to use it( i'm n00b, remember), so if some1 can post a sed expression that does what i need, it would help me a lot.
besides what i said above, really thx in advance to all of you guys, who helped me 'till now, even in such a silly question.
I don't know if that is the answer to your problem, but what I suggest gives what you tell you are looking for.
You didn't provide a real example of the structure of the files you want to compare, so I had to guess with what I present here.
I don't know if that is the answer to your problem, but what I suggest gives what you tell you are looking for.
You didn't provide a real example of the structure of the files you want to compare, so I had to guess with what I present here.
hey guys, long time no see . the above is exactly what i need! really thx to all of u and ur patience!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.