![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 2 huge files wrt to a key using awk | Ranjani | Shell Programming and Scripting | 13 | 07-15-2008 04:58 AM |
| splitting huge xml into multiple files | uttamhoode | Shell Programming and Scripting | 5 | 06-17-2008 07:56 AM |
| Splitting huge XML Files into fixsized wellformed parts | Malapha | Shell Programming and Scripting | 0 | 03-17-2008 11:35 AM |
| comparing Huge Files - Performance is very bad | madhukalyan | UNIX for Dummies Questions & Answers | 5 | 10-10-2006 10:58 PM |
| Huge (repeated Entry) text files | axl | SUN Solaris | 4 | 07-16-2004 07:05 AM |
| View Poll Results: Does Anyone worked with Huge files | |||
| Yes |
|
1 | 100.00% |
| No |
|
0 | 0% |
| Voters: 1. You may not vote on this poll | |||
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Comparing two huge files
Hi,
I have two files file A and File B. File A is a error file and File B is source file. In the error file. First line is the actual error and second line gives the information about the record (client ID) that throws error. I need to compare the first field (which doesnt start with '//') of file A with fifth field of file B. It field values in file A and file B matches i need to write it to output file as below. File A // 223 missing 223,Jan,ee,bla,bla // data not found 254-11,Jan,ee,bla,bla // data rejected 214-1,Jan,ee,bla,bla File B aaaa,bbbb,ccc,dddd,20054-11,fff,ggg... aaaa,bbbb,ccc,dddd,254-11,fff,ggg... aaaa,bbbb,ccc,dddd,2545456-1,fff,ggg... output: // data not found 254-11,Jan,ee,bla,bla if First field of File A and Fifth field of File B (254-11) matches, then i need to write the records from file A (current line and the previous line) to a output file as above. I could achieve it very easily using awk and grep with if loop. Problem is files are hugh. Nearly 1 million records are in both the files. script run for 3-4 hours. I would appreciate if some one could help me in giving good logic or better script which could complete the task in few minutes. Note: File A and File B look exactly in the same format. Caution about the blanks in file A and Client ID fomat 000 or 000-0 or 000-00. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|