Can any one tell me how can i delete all the content
of a file at one go using Vi editor ???
It's urgent
Can any one tell me how can i delete all the content
of a file at one go using Vi editor ???
It's urgent
Few ways actually...
I would go with this one for vi
Inside vi, issue these
:1
dG
:w
It has worked Thanx a lot
or simply:
:%d
:w
or simply
d <Shift g>
That would be under the assumption that the cursor is at line 1.
you could also empty the file out before starting vi ...
echo > /dir/file; vi /dir/file
or simply
$ > /dir/file; vi /dir/file