1820679 Members
2424 Online
109627 Solutions
New Discussion юеВ

Re: script

 
Sanjiv Sharma_1
Honored Contributor

script

Hi,

I have two ascii files tab and ext.
tab consists of names (about 200):
A
B
C
D
ext consists of numbers (about 200):
211
425
413
3124

A is 211, B is 425, C is 413 and so on...

Is there a way to merge this two files so that the new file should be like:
A 211
B 425
B 413
D 3124

Thanks in advance.
Raje.
Everything is possible
6 REPLIES 6
Stefan Farrelly
Honored Contributor

Re: script

see the manpage for the merge command. Its really easy.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Sanjiv Sharma_1
Honored Contributor

Re: script

Hi Stephen,

Thanks for your reply.

I have seen the man page of merge command.
But couldn't do it.
Can you give me the syntax ?
Everything is possible
Carlos Fernandez Riera
Honored Contributor

Re: script

Use paste:

paste tab ext > tabext


unsupported
Robin Wakefield
Honored Contributor

Re: script

Hi Raje,

To use paste with a different separation character, use the -d switch, e.g.

paste -d " " tab ext > tabext

The default is a tab character.

Rgds, Robin.
Michael Tully
Honored Contributor

Re: script

To get a space between the contents of file one and file two:

paste -d "\ " tab ext >tabext
Anyone for a Mutiny ?
Ceesjan van Hattum
Esteemed Contributor

Re: script

Hi Raje,

The answers in which 'paste' is shown are correct, but you didn't give anyone between 8-10 points, meaning that the answers helped you, but that it is not completely satisfying.
Is there anything you would like to see more??

Regards,
Ceesjan