merge three files
Moderators: chulett, rschirm, roy
merge three files
I have three files:
- first file:
0,data
1,data
2,data
etc
-second file:
0,data
0,data
...
1,data
1,data
...
etc
-third file:
0,data
0,data
...
1,data
1,data
1,data
etc
And I need to merge that files by taking for each record from first file, all records with the same key from the second file and after that, all records from third file with the same key. In output file I need only data without keys (ids). How to do that?
Thanks in advance.
Best regards,
Piotrek
- first file:
0,data
1,data
2,data
etc
-second file:
0,data
0,data
...
1,data
1,data
...
etc
-third file:
0,data
0,data
...
1,data
1,data
1,data
etc
And I need to merge that files by taking for each record from first file, all records with the same key from the second file and after that, all records from third file with the same key. In output file I need only data without keys (ids). How to do that?
Thanks in advance.
Best regards,
Piotrek
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
I don't think so. I tried doing it by merge stage, but I didn't get the expected output. As I know merge will take data from first file and merge it with every record in the second with the same key. But I need only once to put data from first file, then only data from second file and then from third file. And so on for each record from first file.Sainath.Srinivasan wrote:Your question has the answer. User Merge stage.
Correct me if I am wrong about merge stage.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi
Please give me a sample output of the merge file. I am not sure whether u want the merged file to look as:
$ cat merge
0,data0 0,data0 0,data0
1,data1 1,data1
2,data2
$ cat file1
0,data0
1,data1
2,data2
$ cat file2
0,data0
1,data1
$ cat file3
0,data0
$ paste file1 file2 file3 > merge
thanks
Pramod
Please give me a sample output of the merge file. I am not sure whether u want the merged file to look as:
$ cat merge
0,data0 0,data0 0,data0
1,data1 1,data1
2,data2
$ cat file1
0,data0
1,data1
2,data2
$ cat file2
0,data0
1,data1
$ cat file3
0,data0
$ paste file1 file2 file3 > merge
thanks
Pramod
Thanks
Pramod
Pramod