297
88
I have a log file that has a bunch of stuff in it that I don't need anymore. I want to clear the contents.
I know how to print the contents to the screen:
cat file.log
I know how to edit the file, line-by-line:
nano file.log
But I don't want to delete each line one at a time. Is there a way to do it in one command without destroying the file to do it?
7On the contrary, @Arekkusandaa.Irujasukin; it works just fine in any version of Windows, so long as, as mentioned, you are using
bash
as your shell and not e. g.cmd.exe
or PowerShell, neither of which are POSIXy enough to be expected to handle such things. – DopeGhoti – 2015-02-05T20:39:21.99061This is probably the raddest command in the history of computing – blarg – 2013-12-02T16:34:26.803