I need help to create file for reading and process information in a file:
File Content:
962113897 B 10/1/04 12/31/04 100%
962113897 O 10/1/04 12/31/04 100%
962115794 B 10/1/04 12/31/04 100%
962115794 O 10/1/04 12/31/04 100%
Fisrt Case:
If the second field contain a “B” I need to repeat the all the registry in the following order and adding a new field containing the following letters G,K,E,O,W,T,U,V on the second column and redirect the result to a file.
Example:
962113897|G|B|100%|10/1/04|12/31/04|
962113897|K|B|100%|10/1/04|12/31/04|
962113897|E|B|100%|10/1/04|12/31/04|
962113897|O|B|100%|10/1/04|12/31/04|
962113897|W|B|100%|10/1/04|12/31/04|
962113897|T|B|100%|10/1/04|12/31/04|
962113897|U|B|100%|10/1/04|12/31/04|
962113897|V|B|100%|10/1/04|12/31/04|
Second Case:
If the second field contain a “O” I need to repeat the all the registry in the following order and adding a new field containing the following letters B,A,D,P,H, on the second column and redirect the result to a file.
Example:
962113897|B|O|100%|10/1/04|12/31/04|
962113897|A|O|100%|10/1/04|12/31/04|
962113897|D|O|100%|10/1/04|12/31/04|
962113897|P|O|100%|10/1/04|12/31/04|
962113897|H|O|100%|10/1/04|12/31/04|
The total result must be like this:
962113897|G|B|100%|10/1/04|12/31/04|
962113897|K|B|100%|10/1/04|12/31/04|
962113897|E|B|100%|10/1/04|12/31/04|
962113897|O|B|100%|10/1/04|12/31/04|
962113897|W|B|100%|10/1/04|12/31/04|
962113897|T|B|100%|10/1/04|12/31/04|
962113897|U|B|100%|10/1/04|12/31/04|
962113897|V|B|100%|10/1/04|12/31/04|
962113897|B|O|100%|10/1/04|12/31/04|
962113897|A|O|100%|10/1/04|12/31/04|
962113897|D|O|100%|10/1/04|12/31/04|
962113897|P|O|100%|10/1/04|12/31/04|
962113897|H|O|100%|10/1/04|12/31/04|
Thank You for your help !
Best Regards !