nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

match the columns of 2 files and merge common rows

This is a discussion on match the columns of 2 files and merge common rows within the Shell scripting forums, part of the Development/Scripting category; there are 2 tab-delimited files a.txt 10 abc 1234 20 def 4356 30 ghi 6789 b.txt 1 20 2 10 ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 11-05-2007, 07:34 PM
Junior Member
User
 
Join Date: Nov 2007
My distro: Debian
Posts: 1
Rep Power: 0
piyali_biobase is on a distinguished road
Default match the columns of 2 files and merge common rows

there are 2 tab-delimited files

a.txt

10 abc 1234
20 def 4356
30 ghi 6789

b.txt

1 20
2 10

Now i want to compare column 1 of a.txt wid column 2 of b.txt and if
both match I wil merge the matching rows into output file

Output shud be

20 def 4356 1
10 abc 1234 2

or

1 20 def 4356
2 10 abc 1234
Reply With Quote
Sponsored Links
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How to match two fields Prahlad Shell scripting 3 04-09-2008 01:58 PM
diff command to exclude files that match pattern piggy Getting started tutorials 1 08-13-2007 11:52 PM
Select specific rows c341 Shell scripting 6 01-18-2007 03:04 AM
Mysql how to specify select columns raj Databases servers 2 12-19-2006 02:23 AM
help me in editing this columns sureshbup Shell scripting 1 12-12-2006 03:29 PM


All times are GMT +5.5. The time now is 07:41 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36