LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-01-2006, 11:44 AM   #1
Xtr3m3
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
Question Config file comparison ideas please ?


Hi All

i am relatively new to Nix so i am hoping that there is a easier solution for my problem:

Problem i have 2 text files ( router configs ) one has 65 lines less that the other , the text files have over 20,000 lines of text so this cannot easily be done manually.


i though about using diff or vimdiff but if 1 line which is in file a is not present in file b it throws the whole diff out.

therefore i was thinking along the lines of a shell script where i read in the larger file and search using a grep function for a line in the smaller file , if not found display in a new text file.


now in theory this sound easy but with my limited scripting knowledge it is taking me ages to get the basic..


can anyone possibly think of a easier solution ?

Kind Rgds X
 
Old 09-01-2006, 11:54 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,372

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
can you describe more about the diff problems? we do diffs on cisco router configs just fine. there are many ways to show diff output, check the manpage for full details, but yeah, more info and i'd like to think diff can do it. there's also things like rancid for the router specific stuff.
 
Old 09-01-2006, 02:51 PM   #3
Xtr3m3
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Hi acid_kewpie

many thanks for the reply , i will go look at the man diff pages arefully

basically it is just two config files (text) and i just want to know which lines are in file B that are not in file A.
 
Old 09-01-2006, 03:06 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
sdiff -s file1 file2
diff --suppress-common-lines file1 file2

:}


Cheers,
Tink
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl - File Comparison PsypherPunk Programming 1 09-01-2006 12:58 PM
File size comparison in bash? dwarf007 Programming 7 08-24-2006 05:46 AM
File Modification Date Comparison MadTurki Programming 7 03-08-2004 04:02 PM
DIFF (or other file comparison) ciscokid1967 Linux - General 1 12-11-2003 02:13 PM
Good File Comparison Utility Witch-King Linux - Software 4 01-01-2003 10:13 PM


All times are GMT -5. The time now is 07:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration