![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare two files and to remove the matching lines on both the files | shellscripter | Shell Programming and Scripting | 4 | 06-20-2009 09:48 AM |
| matching string in two files of different length | ad_meis | Shell Programming and Scripting | 2 | 05-19-2009 11:49 AM |
| Matching and combining two files | sickboy | Shell Programming and Scripting | 3 | 07-17-2008 01:20 PM |
| Matching and combining two files | p3t3r | Shell Programming and Scripting | 5 | 05-20-2008 11:16 AM |
| Find matching lines between 2 files | jojojmac5 | UNIX for Dummies Questions & Answers | 5 | 01-18-2007 01:06 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Matching 2 files
Hi, I am able to modify files (one file) but I have a hard time working with multiple files simultaneously. So I have two files. Basically I want to match two files based on certain columns. Both files are tab-seperated. File1 looks something like this: Code:
num1 89 george num4 78 bob File 2 is a much larger file and looks somethign liek this: Code:
num1 3 lion num1 13 tiger num1 84 bear num4 3 house num4 19 dog num4 77 mouse So what I want to do is match column 1 from Files1 and 2. I also want to substract column 2 from both files. So if they are a match, I want to print (into a seperate file) the row with the smallest difference for column 2. So for my example above, the output file would look like this num1 5 george bear num4 1 bob mouse thanks Last edited by Yogesh Sawant; 07-05-2009 at 11:29 AM.. Reason: added code tags |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|