The original exploded file is as follow

AssyNo P0

Level / PartNo
1 	P1
2 	P2
2.1 	P3
2.1.1 	P4
2.1.2 	P2
2.1.3 	P5
2.1.4 	P6
2.2 	P7
2.2.1 	P8
2.2.2 	P9
2.3 	P10
3 	P11
The flat level output should be

Parent / Child / SeqNo
P0 	P1	1
P0 	P2	2	
P0 	P11	3
P2 	P3	1
P2 	P7	2
P3 	P4	1
P3 	P2	2
P3 	P5	3
P3 	P6	4
P7 	P8	1
P7 	P9	2
The above sample data shows two sub-levels but it can be 10. I am looking for inspiration to do it by programming and I wonder if anybody did that before.

TIA