LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-29-2011, 05:43 AM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 239

Rep: Reputation: 30
compare files


I want to compare zone file counting and same name, not records etc of master and slave dns server so that i sure both server contains same copy of the files at a time.

any utility to compare such files in linix ?
 
Old 03-29-2011, 06:26 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I'm not sure I understand what you're trying to achieve, but the diff command will show the differences between 2 files. Have you tried that yet?
 
Old 03-29-2011, 07:29 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
See also comm http://linux.die.net/man/1/comm
 
Old 03-29-2011, 08:14 PM   #4
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
I would suggest checking the serial numbers if you want to know if
a slave has the same records as the master. Verify that the slave
uses the master in the configuration first. If they have the same
serial number, they should match.

If you simply want to compare two zone files, sort the first file
into a new file, sort the second file into a new file, and then
compare the two files using diff (or comm) as suggested above.
 
Old 03-30-2011, 02:28 AM   #5
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 239

Original Poster
Rep: Reputation: 30
Post

No guys,

I want to achieve below:

server1 server2
a(files) a(files)
b b
c c
d f

Both servers has almost same files . I want to see which files(name) are missing from server 1 and on server 2 as well.
 
Old 03-30-2011, 01:41 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You can use this:
Code:
diff -qr /path/to/dir1 /path/to/dir2
 
  


Reply



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
compare 2 files name specialized Linux - Newbie 2 03-07-2010 04:20 PM
compare two files tekmann33 Linux - Newbie 2 10-28-2008 08:09 AM
compare two files haydar68 Programming 8 08-16-2008 03:36 PM
Compare files in specific directory to files on CD szim90 Linux - Newbie 3 02-10-2007 08:39 PM
Compare two files namit Linux - Software 1 12-31-2005 08:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02: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