Timeline for Is there a way to modify a file in-place?
Current License: CC BY-SA 3.0
3 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 6, 2018 at 14:36 | comment | added | Todd Owen | This is a clever solution that can be further optimized to perform only one compression instead of two: sed -e '/foo/d' MyFile | gzip -c >MyEditedFile.gz && gzip -dc MyEditedFile.gz >MyFile | |
| Jul 31, 2017 at 2:23 | comment | added | nealmcb | But surely gzip is writing the compressed version to the disk before replacing it with the compressed version, so you need at least that much extra space, unlike the other options. But it is safer, if you've got the space (which I don't....) | |
| Mar 24, 2017 at 16:41 | history | answered | Ed Randall | CC BY-SA 3.0 |