.net怎么定位文本内容并批量修改数据?
最近在使用交通仿真软件,改仿真软件的文件保留为一个可以用txt方式打开的文件。这个文件的其中几行是如下:-- Public Transport: --
-----------------------
LINE 1 NAME "" LINE 0 ROUTE 0 PRIORITY 0 LENGTH 0 MDN 0
SOURCE LINK 1 DESIRED_SPEED 5 VEHICLE_TYPE 300
COLOR CYAN TIME_OFFSET 0.0
DESTINATION LINK 1 AT 115.784
START_TIMES 1.0 COURSE 0 OCCUPANCY 1.0 21.0 COURSE 0 OCCUPANCY 1.0 41.0 COURSE 0 OCCUPANCY 1.0 61.0 COURSE 0 OCCUPANCY 1.0 81.0 COURSE 0 OCCUPANCY 1.0
101.0 COURSE 0 OCCUPANCY 1.0 121.0 COURSE 0 OCCUPANCY 1.0 141.0 COURSE 0 OCCUPANCY 1.0 161.0 COURSE 0 OCCUPANCY 1.0 181.0 COURSE 0 OCCUPANCY 1.0
201.0 COURSE 0 OCCUPANCY 1.0 221.0 COURSE 0 OCCUPANCY 1.0 241.0 COURSE 0 OCCUPANCY 1.0 261.0 COURSE 0 OCCUPANCY 1.0 281.0 COURSE 0 OCCUPANCY 1.0
301.0 COURSE 0 OCCUPANCY 1.0 321.0 COURSE 0 OCCUPANCY 1.0 341.0 COURSE 0 OCCUPANCY 1.0 361.0 COURSE 0 OCCUPANCY 1.0 381.0 COURSE 0 OCCUPANCY 1.0
如果我有另外一个txt文件有一批数字如10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200这些数字是随机产生的,要批量替换第一个文件的所有course前的数字,结果如下:
LINE 1 NAME "" LINE 0 ROUTE 0 PRIORITY 0 LENGTH 0 MDN 0
SOURCE LINK 1 DESIRED_SPEED 5 VEHICLE_TYPE 300
COLOR CYAN TIME_OFFSET 0.0
DESTINATION LINK 1 AT 115.784
START_TIMES 10.0 COURSE 0 OCCUPANCY 1.0 20.0 COURSE 0 OCCUPANCY 1.0 30.0 COURSE 0 OCCUPANCY 1.0 40.0 COURSE 0 OCCUPANCY 1.0 50.0 COURSE 0 OCCUPANCY 1.0
60.0 COURSE 0 OCCUPANCY 1.0 70.0 COURSE 0 OCCUPANCY 1.0 80.0 COURSE 0 OCCUPANCY 1.0 90.0 COURSE 0 OCCUPANCY 1.0 100.0 COURSE 0 OCCUPANCY 1.0
110.0 COURSE 0 OCCUPANCY 1.0 120.0 COURSE 0 OCCUPANCY 1.0 130.0 COURSE 0 OCCUPANCY 1.0 140.0 COURSE 0 OCCUPANCY 1.0 150.0 COURSE 0 OCCUPANCY 1.0
160.0 COURSE 0 OCCUPANCY 1.0 170.0 COURSE 0 OCCUPANCY 1.0 180.0 COURSE 0 OCCUPANCY 1.0 190.0 COURSE 0 OCCUPANCY 1.0 200.0 COURSE 0 OCCUPANCY 1.0
最近在做毕业设计,用对这文件的定位和批量修改上非常头疼,请问大家我有什么方法可以实现,怎么实现比较简单。请大家给出思路,我刚学,最好可以给出代码。谢谢大家!