Operating System - HP-UX
1832593 Members
2875 Online
110043 Solutions
New Discussion

Re: what is the command or keys I can enter in vi

 
SOLVED
Go to solution
Hanry Zhou
Super Advisor

what is the command or keys I can enter in vi

to show me some weired characters within a plain UNIX file.

thanks,
none
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor

Re: what is the command or keys I can enter in vi

Hi Hanry,

One way is to run 'cat -v ' to see those characters.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Hanry Zhou
Super Advisor

Re: what is the command or keys I can enter in vi

no, cat -v file doesn't work.


I want to see all characters, like "tab", "space", ...
none
Geoff Wild
Honored Contributor
Solution

Re: what is the command or keys I can enter in vi

From vi:

:set list


Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Rodney Hills
Honored Contributor

Re: what is the command or keys I can enter in vi

cat -vt filename

Including "t" option will dispay tabs, formfeeds, etc as printable text.

HTH

-- Rod Hills
There be dragons...
Sridhar Bhaskarla
Honored Contributor

Re: what is the command or keys I can enter in vi

tab and space are not weird characters. Use Geoff's suggestion if you want to see tabs.

One another way is, take a copy of the file. Run 'vi' on it and in side vi do

:%s/[]//g
:%s/[]//g

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Bill Hassell
Honored Contributor

Re: what is the command or keys I can enter in vi

Or the mainframe style:

xd -xc some_file

This will show every character from NUL to DEL and the hex code for each character. Change -xc to -oc to octal words for each character pair.


Bill Hassell, sysadmin
Andrew Merritt_2
Honored Contributor

Re: what is the command or keys I can enter in vi

I'm not quite sure what is you are asking, so please explain if you're not getting the answers you want.

One option that may do what you want is to use 'vis' and 'inv'. E.g.

vis file >/tmp/tmpfile
vi /tmp/tmpfile
inv /tmp/tmpfile >file

If you want to see spaces and tabs as '\s' and '\t', use the '-t' option to 'vis'.

Andrew