System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Viewing tab, white space and other special character in vi editor

SOLVED
Go to solution
Shivkumar
Super Advisor

Viewing tab, white space and other special character in vi editor

Hi All,

I use "set list" command to view extra space at the end of line in vi editor.

How do i view tab, white space, and other special characters in vi editor ?

Thanks,
Shiv
6 REPLIES
Michael Steele_2
Honored Contributor

Re: Viewing tab, white space and other special character in vi editor

Hi

How's about

nroff -ms file1
nroff -ms file1 | ssp
col -b M < file1
rmnl
cat file1 | col -b
Support Fatherhood - Stop Family Law
Raj D.
Honored Contributor
Solution

Re: Viewing tab, white space and other special character in vi editor

Shiv,

vi do not show all the special or non-printing characters most of times, and depends on version of vi.

Many versions of vi, ':set list' causes -
to show up as ^I
and to be designated by $ .



You can use 'od -cx' to get specil characters details with hex output (#cat filename | od -cx " , or cat -v to see the special characters.

And also you can try using vim or emcs ,


Hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
James R. Ferguson
Acclaimed Contributor

Re: Viewing tab, white space and other special character in vi editor

Hi Shiv:

In lieu of 'vi' it is very convenient to use:

# cat -etv file

Which will list tab characters as '^I'; formfeed characters as '^L'; newline characters as '$'. Other non-printing characters are displayed as defined in the 'ascii(5)' manpages:

http://docs.hp.com/en/B2355-60130/ascii.5.html

You can also use 'vis' to see otherwise non-printing characters:

http://docs.hp.com/en/B2355-60130/vis.1.html

The 'od' or ('xd') utility is also useful. For example using 'xd -ta file' works nicely with text data.

http://docs.hp.com/en/B2355-60130/od.1.html

Regards!

...JRF...
Suraj K Sankari
Honored Contributor

Re: Viewing tab, white space and other special character in vi editor

HI,.
I used to do :se list in vi command prompt after you can see lots of special characters

Tab characters as '^I';
Newline characters as '$'.

to come out from this use se nolist
Suraj
Viveki
Trusted Contributor

Re: Viewing tab, white space and other special character in vi editor

Hi Shiv,

The only command in vi to list characters like tab, carriage return etc is "set list"

See full options at :
http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html
Dennis Handly
Acclaimed Contributor

Re: Viewing tab, white space and other special character in vi editor

>How do I view tab, white space, and other special characters in vi editor?

The same way, :set list

vis(1) also has several options for special chars.

>Raj: You can use 'od -cx' to get special characters details with hex output

If you really want hex, you should use xd(1).