I am using Ubuntu and trying to delete all 100 lines from vi
editor but I got interview question of doing this in one command.
|
||||
In normal mode, do |
|||||||||||||
|
etc. etc. |
|||||||
|
If all lines in the file are to be deleted, this vi command specifies the range of deletion:
|
|||||
|
No matter where are you are in the file, you can do
Doing something like |
||||
|
echo -n > <file>
removes all lines from a file (actually just overwrites the file with ""). – Der Aug 26 at 9:41echo
at all for that;> $file
works just fine. – Michael Kjörling Aug 26 at 13:01vi
in an interview? – Michael Kjörling Aug 26 at 13:02vim-gtk
package, since that gives you access to the xclipboard within vim), typevimtutor
at the command line (not within vim) to get an interactive tutorial of the basics. It shouldn't take more than half an hour, and it's the best starter's guide to using vi/vim that you're likely to find. – evilsoup Aug 26 at 14:03