while on bash, i tried to delete the 3 last columns of a file using:
head -n -3 file > file
but the file comes out empty. I can walkaround it but I would like to know what causes that.
Thanks a bunch!
|
while on bash, i tried to delete the 3 last columns of a file using:
but the file comes out empty. I can walkaround it but I would like to know what causes that. Thanks a bunch! |
|||
|
Let's break down what that command does.
|
||||
|
|
|
What you're trying to do is inline replacement, which isn't really possible without workarounds. In your command, the original file is overwritten because it's already opened and cleared when you send off the command. Here are a couple of ideas: |
|||
|
|
headin your example? – mnmnc Jan 7 at 13:39