Edited: compare two files and print mismatch


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Edited: compare two files and print mismatch
# 15  
Old 07-02-2009
Quote:
Originally Posted by rakeshawasthi
hmm...
that was limited to my understanding of king's problem.
You can very well Try... No, sorting, no formatting... Smilie
Code:
$ grep -v -f file1 file2
abc 112 112
$ grep -v -f file2 file1
abc 112 111
xyz 100 000

@rakesh,

Nope i was looking in same format as before..... the one using sdiff code worked fine except for records which are missing...
And its not file1 against file2 or vice verse.. Have to compare both files.. See example belore again:
File1

abc 1 1 1
abc 2 2 2
abc 3 3 3
abc 5 5 5

File2

abc 1 1 1
abc 2 1 2
abc 3 3 3
abc 4 4 4

Output:

abc 2 2 2 | abc 2 1 2
| abc 4 4 4
abc 5 5 5 |

Last edited by shaliniyadav; 07-02-2009 at 09:22 AM..
# 16  
Old 07-02-2009
Not sure...
may be compareIt can do it... never worked with that.
# 17  
Old 07-19-2009
hi all!

i just want to ask fo rhelp regarding this... the requirements is the same as the original problem stated. the only difference is that that the comparison is only on 2nd and third columns.

thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare two files and print output

Hi All, i am trying to compare two files in Centos 6. F1: /tmp/d21 NAME="xvda" TYPE="disk" SIZE="40G" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="" NAME="xvda1" TYPE="part" SIZE="500M" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="/boot" NAME="xvda2" TYPE="part"... (2 Replies)
Discussion started by: balu1234
2 Replies

2. AIX

Compare two files and show the mismatch columns

I need to compare two files and find the mismatch columns in it for csv and fixed width file. Eg: file1 c1,c2,c3,c4<----columnname 1,a,4,d 2,b,5,e 3,c,6,f file2 c1,c2,c3,c4<----columnname 3,x,7,f 2,y,8,e 1,z,9,d output c2,c3<---- mismatch columname a,4 x,7 b,5 or y,8 Ok with... (3 Replies)
Discussion started by: sabzR
3 Replies

3. Shell Programming and Scripting

Compare two files and print list

Hi Gents, I have 2 files as seen below. File 1: 9 1020 10 1001 11 1001 12 1002 13 1003 14 1004 15 1004 File 2: 9 1000 11 1001 12 1002 13 1003 15 1004 (5 Replies)
Discussion started by: jiam912
5 Replies

4. Shell Programming and Scripting

Compare two files and print using awk

I have 2 files: email_1.out 1 abc@yahoo.com 2 abc_1@yahoo.com 3 abc_2@yahoo.com data_1.out <tr> 1 MAIL # 1 TO src_1 </tr> <tr><td class="hcol">col_id</td> <td class="hcol">test_dt</td> <td class="hcol">user_type</td> <td class="hcol">ct</td></tr> <tr><td... (1 Reply)
Discussion started by: sol_nov
1 Replies

5. Shell Programming and Scripting

Compare columns 2 files and print

File 1 has 16 columns so does File 2 I want to remove all records from File 2 that column 1 and column 16 match between file 1 and file 2 delimter of files is ~ (10 Replies)
Discussion started by: sigh2010
10 Replies

6. Shell Programming and Scripting

Compare selected columns of two files and print whole line with mismatch

hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column. FILE 1: ABS 456 315 EBS 923 163 JYQ3 654 237 FILE 2:... (1 Reply)
Discussion started by: engr.jay
1 Replies

7. Shell Programming and Scripting

Compare two files and mismatch report

Hi I have two files f1 and f2 and comma separated file. I need to comapre two files by field by field and not by whole line. If they match then skip the line from both the files. If they don't match write the mismatch record from f1 to f3. Assume both the files are sorted on first field. ... (5 Replies)
Discussion started by: dgmm
5 Replies

8. Shell Programming and Scripting

compare three files and insert a blank line at each mismatch

i need to compare three files in unix a.txt b.txt c.txt 1 2 1 2 5 3 4 6 5 5 6 6 i need to insert a blank line in the file if i don't find a match and put the items at the same column if found a match The items in the files... (4 Replies)
Discussion started by: mad_man12
4 Replies

9. Shell Programming and Scripting

compare two files and print the last row into first

suppose fileA vis vis gyh gye gyh fileB vis 23 gyh 21 gye 32 output shud be like in fileA ... vis 23 vis 23 gyh 21 gye 32 gyh 21 (1 Reply)
Discussion started by: cdfd123
1 Replies

10. Shell Programming and Scripting

to compare two files and to print the difference

suppose one file P1168S P2150L P85L Q597R R1097C Another file P2150L P85L Q597R R1097C R1379C R1587K Then output shud be R1379C R1587K thanks (5 Replies)
Discussion started by: cdfd123
5 Replies
Login or Register to Ask a Question