Combine Text Files

"Ufuk YILDIRIM [email protected] [sed-users]" <[email protected]> Wed, 18 May 2016 17:17:49 +0300
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hi all,


First thing first, I am a total noob using sed. I can use it for simple 
tasks, but now I need to use it for a for-me-very-complex task. I have 4 
files of student data containing students responses to 4 different 
tests. Some students took two tests some only took one. I want to 
combine the results of a student who took 2 tests in a single line and 
get single file which has all the students and their responses in one 
file. Can I do it with sed? And, if yes, how do I do it?


To clarify my question, here is two file version.


fileA.txt


ID111;a;a;a;a;a;a;a;a;a
ID222222;a;a;a;a;a;a;a;a;a
ID3333;a;a;a;a;a;a;a;a;a


FileB.txt


ID111;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID44;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID3333;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID555;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b




result.txt
ID111;a;a;a;a;a;a;a;a;a;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID222222;a;a;a;a;a;a;a;a;a
ID3333;a;a;a;a;a;a;a;a;a;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID44;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b
ID555;b;b;b;b;b;b;b;b;b;b;b;b;b;b;b


Thank you very much  in advance


Ufuk YILDIRIM