![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing files - adding/subtracting/formating columns | oabdalla | Shell Programming and Scripting | 7 | 06-13-2008 12:20 AM |
| Comparing similar columns in two different files | ragavhere | Shell Programming and Scripting | 13 | 04-16-2008 05:53 AM |
| Comparing the common columns of a table in two files | ragavhere | SUN Solaris | 1 | 04-11-2008 05:41 AM |
| Comparing Columns of two FIles | ggopal | Shell Programming and Scripting | 4 | 02-21-2007 05:06 PM |
| comparing shadow files with real files | terrym | UNIX for Advanced & Expert Users | 4 | 02-08-2007 11:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Comparing Columns of two FIles
Dear all,
I have two files in UNIX File1 and File2 as below: File1: 1,1234,.,67.897,,0 1,4134,.,87.97,,4 0,1564,.,97.8,,1 File2: 2,8798,.,67.897,,0 2,8879,.,77.97,,4 0,1564,.,97.8,,1 I want to do the following: (1) Make sure that both the files have equal number of columns and if not error out (2) If there are equal number of columns then compare each corresponding field from both the files line by line and if there is any difference then print the two different values with line number and column number. I know that 'diff -w' is useful here because it compares ignoring leading, trailing or in-between spaces which is useful because all my columns are numeric. Can I use say 'awk' and its NF and NR variables along with diff? Or is there any other way? Please advise. I thank you for your help. GG |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Please do not cross-post.
|
||||
| Google The UNIX and Linux Forums |