Hidden control characters in a Unix Text File!

Can anyone seem to know how to find out whether a UNIX text file has 'hidden' control characters?

Can I view them using 'vi' by some command line options?

If there are control characters in a text file which are invisible/hidden.. then how do I get rid of them?

Your intelletual answers are greatly appreciated.

Thanks in anticipation.
:confused:

try the :set all in command mode in vi. It will list all the available options.

See what that tells you. I think that the :I will show (using the letter "I") newline and various special characters.

Hope this helps.

vi does not work well with binary data. I suggest that you stay away from vi for this issue. To display the data you can use either "cat -v" or "od -c". Once you know what you're dealing with, "tr -d" can delete unwanted bytes.

Surely VI is okay for text file though?

Using ":set list" in vi will tell you any tab's (^I) and show whitespace by giving you the eol character '$'

Don't know how good this is for other 'special characters' etc.

Don't know if this helps, but python can give you a quick view of the control characters in the file.
python -c "f = open('filename.txt', 'r'); f.seek(0); file = f.readlines(); print file"
Just replace filename.txt with your filename.

Hi pals,

Could you guys clear my doubts?..

I want to remove all white space chars, ctrl key chars, arrow key chars, Esc key char and del key chars...

for ex..

Get the input value[ while typing use all arrow keys/del keys/esc key]
and store it one file. for example you can get this input value as Hello^[[AHow a^[[D]re you^[ "

but, I wanna the o/p will be

                 Hello How are you?

plz, solve my query guys

Thnx in advance

How do you know the A before How is not part of the input?