Removing the entire file contents using unix shell script.

I need to remove the entire file contents in file using the shell script.

Actually the grap -v command will create one more file and it occupy the space also.

I need to remove the entire file contents without creating new file using the shell scripting.

Please help me.

if u want to nullify the file use
:>filename

Thanks for your information.
Can you please give complete script.

Either

$ :>file

or, a bit more brutal,

$ rm -f file && touch file

The second one, though, will cause quite some havoc if a process still has a filehandle open on it.

whether this code $ :>file
will remove all contents from file and put into another file?

If yes then i need code to remove all the file contents without creating new file.

The other code is ok. remove the file and touch file.

':>file' tells the shell to redirect the output of the NOOP command (which is none) to "file", creating it if it doesn't exist, or truncating it if it exists.