I have a ./file.txt
that is:
Lorem ipsum
dolor sit
amet
I want the same ./file.txt
to be:
dolor sit
amet
I don't care about the file in any other way; I'm not going to be doing any further manipulation on it or anything like that. I only want to strip the first line.
std::fs::write
overrides the entire content of a file. I asssume I would need to read the entire file into a String, remove everything from the start of the string until I find a new line (somehow), then override the entire file with that new string. Though maybe it's just me, all of that feels a bit overkill. I do not care for the entire contents of the file.
The reason I'm asking is because I simply do not know how to do this, especially so if there's a better way of going about this whole thing. If there is an obvious simple answer that'd be great.
This question was answered for Rust 1.0, which is rather outdated, to the point where BufReader.lines()
no longer exists.