How to delete a set of numbers in the end of nth text file ?
Show older comments
i have part of the following text file
*Nset, nset=RM1STIFF, instance=Part-1-1
13, 14, 533, 534, 535, 536, 537, 661, 662, 663, 664, 665, 666, 667
*Nset, nset=RMSTIFF2, instance=Part-1-1
25, 26, 959, 960, 961, 962, 963, 1087, 1088, 1089, 1090, 1091, 1092, 1093
*Nset, nset=LMSTIFF1, instance=Part-1-1
17, 18, 675, 676, 677, 678, 679, 803, 804, 805, 806, 807, 808, 809
*Nset, nset=LMSTIFF2, instance=Part-1-1
21, 22, 817, 818, 819, 820, 821, 945, 946, 947, 948, 949, 950, 951
*Nset, nset=RSNODES, instance=Part-2-1
8, 9, 12, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,353, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517
for a specific line i would like to delete set of numbers(2 numbers) and print it to a new file then delete more numbers (4 numbers) and print it to another new file, etc, any help to do that
2 Comments
dpb
on 2 Dec 2014
Are the numeric values on single record or is the linewrap a figment of the display? Is there some auxiliary data that informs the number of elements in each section?
How do you know which line(s) to modify and which values within the lines to change (and to what)?
Basically, the thing with sequential files is that they're, well, "sequential". Which means basically, start a loop, read a line, process it, write the new line, rinse, and repeat until feof().
Eltigani hamad
on 2 Dec 2014
Accepted Answer
More Answers (0)
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!