Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Now,I have two files:

aaaa.txt:

a=0;

b=1;

c=2;

bbbb.txt:

d=3

e=4

f=5

I want to merge aaaa.txt and bbbb.txt to cccc.txt.

cccc.txt as follow:

a=0;d=3

b=1;e=4

c=2;f=5

So, what can I do for this?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You can use paste for this:

paste -d '' aaaa.txt bbbb.txt > cccc.txt

From your question, it appears that the first file contains ; at the end. If it didn't, you could use that as the delimiter by using -d ';' instead.

share|improve this answer
    
@ Chris Down - Thank you very much, it working.By the way, another question: awk '{ sed 's/.*,/999/g' }' cccc.txt why it return awk: { sed s/.*,/999/g } awk: ^ syntax error. What's wrong with it? –  binghenzq Nov 6 '13 at 4:45
    
I'm not totally sure what you're trying to do, but you can't just pass sed to awk like that... –  Chris Down Nov 6 '13 at 5:14
    
@ Chris Down - Thans,I get it. –  binghenzq Nov 6 '13 at 5:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.