replace a line of a file
2 views (last 30 days)
Show older comments
Hello,
we know that we can read the lines of a file by using fgetl or fgets. But i need a function that will replace the lines of a file by a string, just the opposite thing of fgetl. is there such a function? doing this work manually is tedious, so i need such a function. please help
-OBLI
0 Comments
Accepted Answer
per isakson
on 5 Jun 2012
It might be possible to do it inplace with memmapfile. If the lines are the same length, etc. I would not try. Try
loop over all lines
fgetl
if
fprintf
else
fprintf
end
end
to a new file
More Answers (0)
See Also
Categories
Find more on Large Files and Big Data 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!