Operating System - HP-UX
1819518 Members
2914 Online
109603 Solutions
New Discussion юеВ

How can to save and cancel changes in VI Editor

 
SOLVED
Go to solution
Nadine Silue
Advisor

How can to save and cancel changes in VI Editor



Dears,


Can someone help me to know how to save and cancel changes in VI Editor.

PLS
9 REPLIES 9
Pete Randall
Outstanding Contributor

Re: How can to save and cancel changes in VI Editor

To save: wq!
To cancel: q!


Pete

Pete
Wouter Jagers
Honored Contributor
Solution

Re: How can to save and cancel changes in VI Editor

To save and quit (write quit):
- hit ESC
- type ':wq' (without the quotes)

To just save (write):
- hit ESC
- type ':w' (without the quotes)

To quit, cancelling changes (force quit):
- hit ESC
- type ':q!' (without the quotes)

This document provides more very useful info on the vi editor: http://www.eng.hawaii.edu/Tutor/vi.html

Cheers,
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
Jaime Bolanos Rojas.
Honored Contributor

Re: How can to save and cancel changes in VI Editor

Nadine,

Type ZZ to quit the program saving the changes, and if you want to quit without saving the changes type :q!

Press the ESC key to enter those commands...

Also for more references, just search for "vi sheet cheat" on google and you are going to find plenty of good info

Regards,

Jaime.
Work hard when the need comes out.
Dennis Handly
Acclaimed Contributor

Re: How can to save and cancel changes in VI Editor

To save you can use either "ZZ" or :wq
To abort all changes and exit: :q!
To undo the last set of changes, either "u" or "U".

>Pete: To save: wq!
>To cancel: q!

There should be a colon after the to get you into ex(1) command mode.
MarkSyder
Honored Contributor

Re: How can to save and cancel changes in VI Editor

To cancel a change made in error:

esc :u

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
MarkSyder
Honored Contributor

Re: How can to save and cancel changes in VI Editor

Oops! Dennis, I was only 1 minute 18 secs behind you, so I think you can see I wasn't point hunting ;-)

Mark
The triumph of evil requires only that good men do nothing
Adam W.
Valued Contributor

Re: How can to save and cancel changes in VI Editor

man vi
There are two types of people in the world, Marines and those who wish they were.
Khairul_1
Frequent Advisor

Re: How can to save and cancel changes in VI Editor

Hi Nadine

use super user root for edit any system file:
you can get more help from
#man vi
#vi

To save: wq!
To cancel: q!

Thanks
khairul
Asif Sharif
Honored Contributor

Re: How can to save and cancel changes in VI Editor

Read the vi editor Quick reference.

http://www.adminschoice.com/docs/vi_editor_ref.htm

Regards,
Asif Sharif
Regards,
Asif Sharif