![]() |
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 files | danabo | Shell Programming and Scripting | 3 | 05-19-2008 12:09 PM |
| ZaReason's MegaLap is a desktop replacement with an Ubuntu twist | iBot | UNIX and Linux RSS News | 0 | 04-07-2008 11:00 AM |
| Suspending jobs (CTRL+Z) with a twist | d11wtq | UNIX for Dummies Questions & Answers | 2 | 06-21-2005 03:59 AM |
| compare files again | ithomp | Shell Programming and Scripting | 2 | 06-17-2004 03:46 AM |
| how do I log into this machine - with a twist... | xyyz | UNIX for Dummies Questions & Answers | 1 | 08-29-2001 08:57 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Compare 2 files yet again but with a twist
Ok so I have a file which contains 2 columns/fields and I have another file with 2 columns. The files look like:
file1: 1 33 5 345 18 2 45 1 78 31 file2: 1 c1d2t0 2 c1d3t0 3 c1d4t0 4 c1d4t0 5 c2d1t0 6 c2d1t0 7 c2d1t0 8 c2d1t0 9 c2d1t0 10 c2d1t0 11 c2d5t0 18 c3d1t0 45 c5d10t0 78 c3d12t0 --- I need to get the following result: 1 33 c1d2t0 5 345 c2d1t0 18 2 c3d1t0 45 1 c5d10t0 78 31 c3d12t0 --- I know there is an elegant awk solution but I am getting a little lost when doing the search on the first column. |
|
||||
|
@radoulov:
unfortunately I didn't have access to my sun box yesterday - and now when I test it I get this: /usr/xpg4/bin/awk: syntax error Context is: >>> NR == FNR {_[$1] = $2 next <<< with nawk it's: nawk: syntax error at source line 1 context is NR == FNR {_[$1] = $2 >>> next <<< } $2 = $2 FS _[$1] nawk: illegal statement at source line 1 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|