Operating System - HP-UX
1825759 Members
2206 Online
109687 Solutions
New Discussion

Re: vi inserting control characters

 
SOLVED
Go to solution
Denise Borgen
Occasional Contributor

vi inserting control characters

How do you insert ^C, ^D, ^E, etc. in a file using the vi editor. I used to know this but I haven't needed it for a few years.
6 REPLIES 6
Scott Palmer_1
Trusted Contributor

Re: vi inserting control characters

Hello,

try VC...etc

Regards

Scott Palmer
Denise Borgen
Occasional Contributor

Re: vi inserting control characters

Ooooh!, That's it, and fast thanks.
Scott Palmer_1
Trusted Contributor
Solution

Re: vi inserting control characters

Think nothing of it

Scott
A. Clay Stephenson
Acclaimed Contributor

Re: vi inserting control characters

The 'trick' is to put vi into edit code (normal 'i') and then enter Cntrl-V, the next character will be quoted.

Thus to enter Cntrl-D,Cntrl-E,ESC you would
1) Position cursor and press 'i'
2) Ctrl-V,D,Ctrl-V,E,Ctrl-V,ESC
3) ESC to end insert

Use od -c to view the file.

If it ain't broke, I can fix that.
Denise Borgen
Occasional Contributor

Re: vi inserting control characters

Thanks, problem solved, ( and put in our solutions database correctly this time) And thanks for the od command, that is something I can use.
Bill Hassell
Honored Contributor

Re: vi inserting control characters

When you are dealing with binary files, the mixed hex format is a great help:

xd -xc /somefile


Bill Hassell, sysadmin