I\'ve got a script that calls grep to process a text file. Currently I am doing something like this.
$ grep \'SomeRegEx\' myfile.txt > myfile.txt.temp $ m
No, in general it can't be done in Unix like this. You can only create/truncate (with >) or append to a file (with >>). Once truncated, the old contents would be lost.