1834458 Members
2992 Online
110067 Solutions
New Discussion

option :X in editor VI

 
SOLVED
Go to solution
Jairo Campana
Trusted Contributor

option :X in editor VI

hello , editing in vi my shell script press the key,mode
:X
enter key
I lost the data, with recovery or return a my shell script original

only see caharacter type:
2\320ex) \301t^^$1r!
legionx
6 REPLIES 6
Mark Greene_1
Honored Contributor

Re: option :X in editor VI

the :X command is to enter encryption mode. You've encrypted the file. Do you recall what you typed after the :X? That is the encryption key. You can do this:

vi file -x

and it will prompt you for the key. See the man page on vi for more. If you cannot recall the encryption key, your file is most likely lost.

mark
the future will be a lot like now, only later
harry d brown jr
Honored Contributor
Solution

Re: option :X in editor VI


Did you want to encrypt your file, because that's what the :X does.

Do you remember what you typed in when it prompted you to "Enter key" ??

If you do, then do this:

vi -C filename

and enter in the "key"

live free or die
harry
Live Free or Die
Frank Slootweg
Honored Contributor

Re: option :X in editor VI

Harry,

I think you mean "-x" instead of "-C". At least that is what I always use, and, as far as I know, there is no option "-C".
Balakumar M
Frequent Advisor

Re: option :X in editor VI

Hi,
Check the TERM value.
I have also attached Vi editor option, it could be helpfull for you.

5) VI editor options
Three Types of Modes,
Command Mode,
Last Line Mode
Insert or Input Mode,

Cursor Movement,
l ??? Move one Character Right
h- Move one Character Left
j- down
k- up
G- Go to Last Line of the file
NG- Go to line number n in the file
$- End of the Current line
^ - Beginning of the Current line
H- First line of the Screen
M- Middle line of the Screen
L- Last line of Screen
Ctrl-G find out which line your in the file
$G End of the last line of the file

INSERT Command

i ??? Insert Current Cursor location
I ??? Insert at the beginning of the Current line
,a ??? Insert text at the next character position relative to the current cursor location
A ??? End of the Current line
o- Blank line below the current line
O- Blank line above the current line

Deleting command

x delete character
nx n character starting from current cursor location
X Delete previous character from the current cursor
,nX n previous character from the current location
dd delete current line
db delete previous word
dw current cursor location forward word
dG delete end of the file including current line

Replacement Command
r- Replace Current Character remain in command mode
s- Replace current Character and go to insert mode
R- Replace Multiple Character until the Esc key is pressed
cw- Change to the beginning of the next word
cc- change the entire line
cG change ot the end of the line

Undo and Redo
,u Undo the last changes
U undo the Changes made to the current line
. Redo something changed by undo

Scrolling text

Ctrl ??? b Scroll one screen back
Ctrl ??? f Scroll one screen forward
Ctrl ??? u Scroll half screen back
Ctrl ??? d half screen forward

Search and Replace

/ search text forward
? search text backword
/ Repeat the search
? Repeat the search backword
n Repeat search in the same direction
N Repeat search in the opposite direction
:s/old/new search and replace
:m,ns/old/new from m to n line search and replace
:s/old/new/g search entire file and replace
/ searchtext only the whole word are searched
/^text search from beginning of a line
/text$ search end of the line


Yanked or copied
Yy ??? copy current line
Nyy- copy n lines starting form current line position
p paste the txt after the current cursor
P paste the txt before the current cursor
:ma move current line and paste after the line number ???a???
:a.bmc Move line from a to b and paste after line number c
:a,btc copy the line from a to b and paste after the line number c
:r import the another file into the current line
:w :3,37w filename copy the current edited file to another file

:set number
:set all
:set readonly
:set wrapmargin =n

Regards,
Bala
Life is a continues learning process
Jairo Campana
Trusted Contributor

Re: option :X in editor VI

the commadn is
vi -C filename

the problem is that remember the key

when exit the vi with x! it was activated caplocks

write the script again.

thanks
legionx
Frank Slootweg
Honored Contributor

Re: option :X in editor VI

In case others are wondering as well:

"-C" is apparently a 'new', HP-UX 11.0 and higher, vi(1) option which is similar to (but not the same as) "-x". See the vi(1) manual page for details.