![]() |
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 |
| sql,multiple join,outer join issue | robbiezr | High Level Programming | 0 | 06-06-2009 12:26 AM |
| awk, join or sed | jkl_jkl | Shell Programming and Scripting | 1 | 04-15-2008 06:55 AM |
| Join | jazz8146 | UNIX for Dummies Questions & Answers | 5 | 01-29-2008 11:42 AM |
| join (pls help on join command) | summer_cherry | Shell Programming and Scripting | 1 | 12-31-2007 05:19 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
awk for join
Is it possible to do this with awk command??
sort1.txt Code:
a 10 b 20 Code:
a b c d Code:
join sort1.txt sort2.txt && join -v1 sort2.txt sort1.txt Code:
a 10 b 20 c d ---------- Post updated at 05:44 PM ---------- Previous update was at 05:35 PM ---------- I come up with this. working fine but still has some join command in it Code:
gispc290 ~/Desktop
$ awk 'NR==FNR{_[$1]=$1;next}$1 in _{print _[$1],$2,$3}' sort2.txt sort1.txt && join -v1 sort2.txt sort1.txt
---------- Post updated at 05:58 PM ---------- Previous update was at 05:44 PM ---------- May be this Code:
gispc290 ~/Desktop
$ awk 'NR==FNR{_[$1]=$1;next}$1 in _{print _[$1],$2,$3}' sort2.txt sort1.txt && awk 'FNR==NR{a[$1]++;next}!a[$1] {print $0}' sort1.txt sort2.txt
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|