Overwrite a textfile in SystemVerilog

I want to overwrite the contents in a textfile in a particular line in SystemVerilog. Is it possible to overwrite the contents of file? If yes, can you give me an example. I couldn’t find any example on internet.

In reply to monikasidde:

It can be done but the SystemVerilog is not the best language to do this in. You would only be able to replace characters and not change the line length. You would have to read a line at a time with $fgets or $fscanf, then use $ftell to capture the file position of each line.

Thank you so much. It helped me a lot.