Ricky White
asked on
C# text file manipulation help
Environment: C#
Begin
1600016089875 031
1600016089883 125
1600016089875 033
1600016089875 033
1600016089875 034
1600016089875 036
1600016089875 037
1600016089875 038
1600016089875 039
1600016089875 021
1600016089875 024
End
I am creating a txt file with some rows between Begin and End and its working fine. Now, I would like to split the records so that there are a maximum of only 3 rows between each Begin-End block within the same file.
The output for temp.txt should look something like below:
Begin
1600016089875 031
1600016089883 125
1600016089875 033
End
Begin
1600016089875 033
1600016089875 034
1600016089875 036
End
Begin
1600016089875 037
1600016089875 038
1600016089875 039
End
Begin
1600016089875 021
1600016089875 024
End
Please advise, what would be an easy and efficient method to achieve this?
Thanks.
Begin
1600016089875 031
1600016089883 125
1600016089875 033
1600016089875 033
1600016089875 034
1600016089875 036
1600016089875 037
1600016089875 038
1600016089875 039
1600016089875 021
1600016089875 024
End
I am creating a txt file with some rows between Begin and End and its working fine. Now, I would like to split the records so that there are a maximum of only 3 rows between each Begin-End block within the same file.
The output for temp.txt should look something like below:
Begin
1600016089875 031
1600016089883 125
1600016089875 033
End
Begin
1600016089875 033
1600016089875 034
1600016089875 036
End
Begin
1600016089875 037
1600016089875 038
1600016089875 039
End
Begin
1600016089875 021
1600016089875 024
End
Please advise, what would be an easy and efficient method to achieve this?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER