![]() |
|
|
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 |
| Trouble with awk | RichieFondel | Shell Programming and Scripting | 1 | 01-17-2008 07:30 AM |
| join (pls help on join command) | summer_cherry | Shell Programming and Scripting | 1 | 12-31-2007 05:19 AM |
| The trouble about SU ... | nulnul7 | UNIX for Dummies Questions & Answers | 4 | 10-05-2005 12:39 PM |
| The trouble with... | zazzybob | What's on Your Mind? | 6 | 01-18-2005 06:01 AM |
| trouble | awk | UNIX Desktop for Dummies Questions & Answers | 1 | 11-22-2002 10:51 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
trouble with join
Hello
I've got two files; each has 6 records each. I want to join the files so I can compare the reserved space of tables on one server with the same tables on another server. I tried the join command but, it 's not joining all of the rows. I know I'm missing something simple but, I can't see it. Here is file1 fctenv01 CER_MCZT_ZIP_TRANS 79877 11776 10868 776 132 fctenv01 CMC_CECE_CRITERIA 150911 17692 17512 112 68 fctenv01 CMC_EBCL_EOB_DATA 106651 3168 3004 24 140 rptenv01 CER_MCZT_ZIP_TRANS 79877 11779 10877 766 142 rptenv01 CMC_CECE_CRITERIA 150923 18692 17522 122 78 rptenv01 CMC_EBCL_EOB_DATA 106652 3768 3114 44 240 Here is file2 fctenv01 CER_MCZT_ZIP_TRANS 80225 12320 10700 1496 124 fctenv01 CMC_CECE_CRITERIA 150930 17692 17512 112 68 fctenv01 CMC_EBCL_EOB_DATA 106470 3136 3000 28 108 rptenv01 CER_MCZT_ZIP_TRANS 80229 12439 12475 1596 224 rptenv01 CMC_CECE_CRITERIA 151230 18792 18722 212 78 rptenv01 CMC_EBCL_EOB_DATA 116570 3276 3123 78 128 Here is the join statement I am using join -1 2 -2 2 $file1 $file2 | awk '{tot=$3-$4};{print $2,$1,$3,$4,tot}' | sort -1 +4rn And here is the output fctenv01 CMC_CECE_CRITERIA 150911 17692 133219 fctenv01 CMC_EBCL_EOB_DATA 106651 3168 103483 fctenv01 CER_MCZT_ZIP_TRANS 79877 11776 68101 rptenv01 CMC_EBCL_EOB_DATA 106652 3768 102884 rptenv01 CMC_EBCL_EOB_DATA 106652 3768 102884 The first two rptenv01 tables are missing on the output and the last rptenv01 table is listed twice. Here is the output I would like the join to give me fctenv01 CMC_CECE_CRITERIA 150911 17692 133219 fctenv01 CMC_EBCL_EOB_DATA 106651 3168 103483 fctenv01 CER_MCZT_ZIP_TRANS 79877 11776 68101 rptenv01 CMC_CECE_CRITERIA 150923 18692 132231 rptenv01 CMC_EBCL_EOB_DATA 106652 3768 102884 rptenv01 CER_MCZT_ZIP_TRANS 79877 11779 68098 What am I missing? Any help would be greatly appreciated! tia |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|