Diff 3 files, but diff only their 2nd column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Diff 3 files, but diff only their 2nd column
# 8  
Old 03-13-2015
Smilie

I was merely giving you an example. As mentioned ... well in the code, it's really for IP lookups.

(in other words, I guess is didn't help any... which I also said might be the case)

I'll let others write your code for you.... it's not that hard (you can figure it out I'm sure!) in your *very specific* case.
# 9  
Old 03-18-2015
Got this.

Code:
for i in `cat d.tx`
do
a=`cat $i.registrant|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`
b=`cat $i.admin|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`
c=`cat $i.tech|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`
diff <(echo "${a}")  <(echo "${b}")|grep ">"|sed -e 's/>//'|sed 's/^.//'  > $i.diff
#echo "$i.diff"
done


Last edited by vgersh99; 03-18-2015 at 12:05 PM.. Reason: code tags, please!
# 10  
Old 03-18-2015
Interesting approach....
I fail to see a kitchen sink in there. Where is it?
# 11  
Old 03-18-2015
first divide them

Code:
a=`cat $i.registrant|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`
b=`cat $i.admin|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`
c=`cat $i.tech|awk -F: '{print $2}'|sort|sed '/^\s*$/d'`

and get the diff

---------- Post updated at 10:20 AM ---------- Previous update was at 10:17 AM ----------

Ah i got you

1. run a script

Code:
whois ymas.uy| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > /home//whois/doms/ymas.uy.registrant
whois ymas.uy| sed -n '/Registry Admin ID:/,/Admin Email:/p' > /home//whois/doms/ymas.uy.admin
whois ymas.uy| sed -n '/Registry Tech ID:/,/Tech Email:/p' > /home//whois/doms/ymas.uy.tech

whois ymas.uy.com| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > /home//whois/doms/ymas.uy.com.registrant
whois ymas.uy.com| sed -n '/Registry Admin ID:/,/Admin Email:/p' > /home//whois/doms/ymas.uy.com.admin
whois ymas.uy.com| sed -n '/Registry Tech ID:/,/Tech Email:/p' > /home//whois/doms/ymas.uy.com.tech



2. create trext file that contain your domains

vi d.tx


3. run the script above


this is such a pain..we have plety of domain and my boss wants me to identify where entries is mismatch.. man....in excel file..

you know sysadmins hates inventory/documentation and EXCEL FILE
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Diff between two time in hours in last column

Dear All I want to diff between two time(FIRST 4 COLUMN) in hours in last column. Kindly help me for same. 2013-11-23 15:51:23 2013-11-23 12:20:06 BRC023 CG 2013-11-23 15:51:23 2013-11-23 12:20:08 BRC064CG 2013-11-23 15:51:23 2013-11-22 13:17:49 BLM003 NG 2013-11-23 15:51:23 2013-11-22... (9 Replies)
Discussion started by: jaydeep_sadaria
9 Replies

2. Shell Programming and Scripting

Transpose Datefield from rows to column + Print time diff

Hi Experts, Can you please help me in transposing Datefield from rows to column and calculate the time difference for each of the Jobids: Input File: 08/23/2012 12:36:09,JOB_5340 08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350 08/23/2012 12:36:26,JOB_5350 Required Output:... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

3. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

4. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

5. Shell Programming and Scripting

diff bw two files

Hi All, I have two files which look as below File1 serial="1" name="abc" type="employee" field="IT" serial="2" name="cde" type="intern" field="Marketing" serial="3" name="pqr" type="contractor" field="IT" serial="4" name="xyz" type="employee" field="Sales" File2 serial="1"... (3 Replies)
Discussion started by: grajp002
3 Replies

6. Shell Programming and Scripting

diff of files

Hi, I have 2 files.I want to check if file1 is contained in file2. A.txt: ----- AAA BBB B.txt: ------ CCC AAA BBB DDD I want to check if A.txt is contained in B.txt. Can it be done using SED ? (12 Replies)
Discussion started by: giri_luck
12 Replies

7. Shell Programming and Scripting

Diff b/w 2 files

Hi Masters, I have two files named file1 and file2. Both the files contains the same contents with some difference in comments,space.But no content change. I tried to find the diff between the two files to make sure that contents are same. For that i tried diff -ibw file1 file2 But... (1 Reply)
Discussion started by: ecearund
1 Replies

8. Shell Programming and Scripting

Simulate SVN diff using plain diff

Hi, svn diff does not work very well with 2 local folders, so I am trying to do this diff using diff locally. since there's a bunch of meta files in an svn directory, I want to do a diff that excludes everything EXCEPT *.java files. there seems to be only an --exclude option, so I'm not sure... (3 Replies)
Discussion started by: ackbarr
3 Replies

9. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
Login or Register to Ask a Question