12233893487687687823 8736981111 52004554454450000411 8736981111,8736983268 62189347620012345611 8736981111,8736983268 799R0224082000000001 8736981111,8736983268 62789347620056665611 8736981111,8736983268 799R0324082000000001 8736981111,8736983268 62189347620012345611 8736981111,8736983268 799R0224082000000000 8736981111,8736983268 62189347620012345611 8736981111,8736983268 799R0224082000000000 8736981111,8736983268 82000000020089347620 8736981111,8736983268 52001021000020000407 8736981111,8736983269 62189347620099945458 8736981111,8736983269 799R0424082000000000 8736981111,8736983269 82000000020089347620 8736981111,8736983269 52001021000020000411 8736981111,8736983270 62189347620012345643 8736981111,8736983270 798C0224082000000000 8736981111,8736983270 82000000020089347620 8736981111,8736983270 52001021000020000407 8736981111,8736983271 62189347620099945458 8736981111,8736983271 798C0524082000000000 8736981111,8736983271 82000000020089347620 8736981111,8736983271 90000040000020000000 8736981111,8736983271
I have the file format as shown above, the starting line of the file starts with "1" which is the File header record, the line that start with "5" which is the batch header, the line that starts with "6" is the detail information in that batch record, line that starts with "7" is the additional batch detail. The lines "6" and "7" continues untill the line starts with "8" which indicates that one batch is finished. So the next batch again start with the line "5" indicating the start of the next batch. Similarly, the same steps will repeat as mentioned above and when the line starts with "9" it indicates that all the batch records are done for the file will and end this id indicates file footer information.
So, my question is - I want to add some unique identification number at the end of each line as shown in the above image (I have manually added those number after the space on end of each line) and I want a solution to read this text file and generate these unique numbers based on the above condition that I have explained in paragraph 1. So after the end of every batch i.e., line "8" it should start the next batch with the next unique number as shown in my image. Can you please suggest me how I can achieve this using Go language or C#.