Txt file format:

19,"n","d","m" 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08435059 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 1.00000000,262.08432007 

19 - the number of lines. It is necessary to replace (in this case) digit 1 with numbers from 0 to 180 with a step of 10, i.e. It should be:

 19,"n","d","m" 0.00000000,262.08432007 10.00000000,262.08432007 20.00000000,262.08432007 30.00000000,262.08432007 40.00000000,262.08432007 50.00000000,262.08432007 60.00000000,262.08432007 70.00000000,262.08432007 80.00000000,262.08435059 90.00000000,262.08432007 100.00000000,262.08432007 110.00000000,262.08432007 120.00000000,262.08432007 130.00000000,262.08432007 140.00000000,262.08432007 150.00000000,262.08432007 160.00000000,262.08432007 170.00000000,262.08432007 180.00000000,262.08432007 

In this example, from 0 to 180 in increments of 10, i.e. 19 lines. But there may be another step (1, 2,3, 4, 5, 6.9, 10, 12, 15, 18,20,30, 36, 45)

  • At another step, the number of rows, respectively, will be different. It is always prescribed - AlexS
  • And what is your difficulty? You do not know how to count the file? Or how to write it back? Or how to make a replacement in the line? - Andrew NOP
  • I am not strong in this. From time to time you need to solve such puzzles. I try, but ... I understand that this is not a freelance website, and at the same time I understand that the task is very simple ... - AlexS
  • 3
    I am not strong in this - in which particular issue? I called them three. If in each, then you need to ask them separately, the question is still too general - Andrew NOP
  • On the Internet, a lot of information on reading the file, with this more or less. Then, as @Nova replied 'var splits = string.Split (', ');' . Next 'ar result = double.Parse (splits [0]);' Further, the most difficult - replacement. - AlexS

1 answer 1

You read the file line by line, you enter the lines into the List. As you read the entire file, in the list cycle, you separate the lines (var splits = string.Split (',');) and the first element of the parish (var result = double.Parse (splits [0]);) add the required term to it. Next, from the resulting amount and the remainder of splitting the line, you form a new line, and add it to the new list of modified lines. Voila!