I have a base file FILE1 with the following data
FILE1.dat
21111111110001343 000001004OLFXXX029100020091112
21111111110000060 000001004ODL-CH001000020091112
22222222220000780 000001013OLFXXX006500020091112
23333333330001695 000001039OLFXXX030600020091112
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
24444444440001416 000001045OLFXXX011800020091112
......
......
..etc
i want to write a program in .KSH that the FILE2.dat should have only 4 unique records like below appending two new columns spouse_col & child_col at the end of each line based on position.
Remember this should be in while read line do loop
ODL-Ch = child_col ,
ODL-Sp = spouse_col
if ODL-SP then grab position 11-18 and copy to the position 50-57
elif ODL-CH then grab position 11-18 and copy to the position 58-65
fi
FILE2.DAT
blue color is mapped to spouse_column and red color mapped to child_column
21111111110001343 000001004OLFXXX029100020091112 0000000 0000060
22222222220000780 000001013OLFXXX006500020091112 0000000 0000000
23333333330001695 000001039OLFXXX030600020091112 0000111 0000060
24444444440001416 000001045OLFXXX011800020091112 0000000 0000000
thanks