Ufuk YILDIRIM yildirim_ufuk@yahoo.co.uk [sed-users]
2016-05-18 14:17:49 UTC
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
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