I only need to read the first line of a huge file and change it.
Is there a trick to only change the first line of a file and save it as another file using Python? A
The sh module worked for me:
sh
import sh first = "new string" sh.sed("-i", "1s/.*/" + first + "/", "file.x")