Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 09-01-2006, 11:44 AM   #1
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
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
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
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
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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




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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:23 PM.

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