plz help me to compare
Dear all
I want to compare the zones in both my Linux Bind servers, So I greped the first line of all of them with #> grep 'zone "' named.conf > named.1 and the same for named.conf 2 now I get two files named.1 named.2, with the following syntax zone "domain1.com" in { zone "domain2.com" in { zone "domain3.cc" in { zone "domain4.net" in { zone "domain5.tv" in { etc.. First Can any one tell me a grep command to just get the domains name between the "" in a file second I want to compare between the both files and get the domains that in named.1 and not found in named.2 |
Not tested:
Code:
egrep -o '"[^"]+"' file1 | sed 's/"//g' > comp1 Cheers, Tink |
Thanx so much
the first command worked perfectly But there's something in the second one It compared with two files as they are arranged like each others, But they don't For example name1 zone "domain1.com" in { zone "domain2.com" in { zone "domain3.cc" in { zone "domain4.net" in { zone "domain5.tv" in { etc.. But named2 zone "domain5.tv" in { zone "domain3.cc" in { zone "domain2.com" in { zone "domain4.net" in { zone "domain1.com" in { etc.. I just want it to get the domains that are in one of them and not in the other, To add it to the other one, Got it. Thanx for your help. |
Quote:
Code:
$ cat name1 name2 |sort |uniq > allnames |
Code:
egrep -o '"[^"]+"' file1 | sed 's/"//g' | sort > comp1 Cheers, Tink |
No I don't want to arrange them, I just want to compare.
Thanx for help |
I recently had to prepare scripts that extracted the names of mpeg files in several video devices against one of the devices. I used the "comm" command to find entries in one list that were unique, and then used that list as a grep pattern file to the original.
Code:
$ cat rdytospot Code:
Using different samples: $ cat named1 zone "domain1.com" in { zone "domain2.com" in { zone "domain3.cc" in { zone "domain4.net" in { zone "domain5.tv" in { $ cat named2 zone "domain8.tv" in { zone "domain3.cc" in { zone "domain7.com" in { zone "domain4.net" in { zone "domain1.com" in { $ grep -f UniqInNamed2 named2 zone "domain8.tv" in { zone "domain7.com" in { |
Quote:
garbage. With the sorting you get two sets that (most likely) won't appear in either, and then you could feed them back. If that's not what you're after *I* can't help you. Cheers, Tink |
try this:
Code:
# system 1 |
Dear all
Thanx so much ,You really helped me so much THax all again. :) |
All times are GMT -5. The time now is 09:55 PM. |