I have a large file "file.txt"
I want to read one specific line from the file, change something and then write that line back into its place in the file.
Being that it is a large file, I do not want to read the entire file during the reading or writing process, I only want to access that one line.
This is what I'm using to retrieve the desired line:
$myLine = 100;
$file = new SplFileObject('file.txt');
$file->seek($myLine-1);
$oldline = $file->current();
$newline=str_replace('a','b',$oldline);
Now how do I write this $newline to replace the old line in the file?