LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-20-2004, 01:45 PM   #1
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,091

Rep: Reputation: 41
Compare two cvs files....


How can I compare two cvs files line by line only and put the non-matching lines into a new file??

Broken down questions,

I have two CVS files, 1 and 2 respectivly, each has lets say two fields... Name and Badge

I need to compare the differences on file 2 with file 1. Or easier said... I need to know what is on file 2 that is not on file one and move that information two file 3?

I need this to be done line by line, not chacter per charcter....


I have looked at "man diff" and I cannot figure out if this command will do this or not.. It does not seem to output like i needed..

I have looked at comm, of course the man page is kinda small on this one.. so I doubt this will do what I need. and I have looked at all commands related to these two....

Is there anything out there???


Also I am not sure if this is the correct forum to ask this question... as it applies to unix or linux.

Thanks
Trey
 
Old 10-21-2004, 10:51 AM   #2
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,091

Original Poster
Rep: Reputation: 41
ttt, any ideas?
 
Old 10-22-2004, 12:25 PM   #3
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
To do it directly through CVS you would use the cvs diff command. For example, to view the differences between the 1.0 revision and 1.1 revision of the file helloworld.c you would use cvs diff -r1.0 -r1.1 helloworld.diff. You could also use date tags instead of revision numbers if you don't know or don't care about the version numbering.

When using normal diff you can use the -uN switches to use the unified format (which is pretty human-readable): diff -uN file1.c file2.c > differences.diff
You can then use vim to view the resulting diff file in pretty colorization.



Håkan
 
Old 10-23-2004, 08:05 PM   #4
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,091

Original Poster
Rep: Reputation: 41
Thumbs up

Quote:
Originally posted by hw-tph
To do it directly through CVS you would use the cvs diff command. For example, to view the differences between the 1.0 revision and 1.1 revision of the file helloworld.c you would use cvs diff -r1.0 -r1.1 helloworld.diff. You could also use date tags instead of revision numbers if you don't know or don't care about the version numbering.

When using normal diff you can use the -uN switches to use the unified format (which is pretty human-readable): diff -uN file1.c file2.c > differences.diff
You can then use vim to view the resulting diff file in pretty colorization.



Håkan
That seems to do what I am looking for!

Thanks
Trey
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
create a cvs repository with existing files to cvs powah Linux - Software 1 08-19-2005 09:19 AM
How do I compare 2 files? linuxhippy Slackware 6 03-26-2005 01:54 AM
Diff compare 2 files DavidTempler Linux - Newbie 2 11-01-2004 10:00 AM
I'm looking for a perlscript to compare size of 2 files cccc Programming 5 02-28-2004 04:45 PM
to compare the contents of 2 files MaleWithBrains Linux - Newbie 3 01-27-2004 06:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration