Operating System - HP-UX
1830899 Members
1990 Online
110017 Solutions
New Discussion

Re: how to merge two file like this?

 
SOLVED
Go to solution
thebeatlesguru
Regular Advisor

how to merge two file like this?

file A:
a
b
c
file B:
A
B
C
i wanna merge A,B into C like this:
a
A
b
B
c
C
hihi
3 REPLIES 3
Steve Steel
Honored Contributor

Re: how to merge two file like this?

Hi


try

sort -df file1 file2 > file3



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Robin Wakefield
Honored Contributor
Solution

Re: how to merge two file like this?

Hi,

Try:

paste -d '\n' fileA fileB

Rgds, Robin
Peter Kloetgen
Esteemed Contributor

Re: how to merge two file like this?

Hi Guru,

the paste command can solve your problem!

man paste ....

---paste concatenates corresponding lines of the given input files---
---Without the -d option the newline characters of all but the last file are replaced by a tab character-----

so use the following command:

paste -d '\n' file1 file2

This should do it for you!

Allways stay on the bright side of life!

Peter


I'm learning here as well as helping