Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I display "hidden" characters in a file 1

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I have a shell script that has some hidden characters or control codes embedded.
How do I display those codes ?
 
Vi'ing the script would usually show any control characters (for example ^M in a dos-origin file). If not, perhaps you could do a unix2dos <filename> <newfile> and then vi <newfile> in the hope that this would show the characters. Good luck.
 
Depending on the size of the file, you could try a hex dump of it with

od -xc filename | more

It's not that easy to read, but if you cut and paste the lines from your script into a new file first it might make it a bit easier. The hex dump will show you the values of any dodgy characters in the file.

Regards,
LHLTech

IBM Certified Specialist - AIX System Support
Halfway through CATE exams!
 
in vi, use the colon command:

:set list

this will cause all control characters to display as their ASCII representation ( formfeed=^L, tab=^I, etc...)

to hide them again:

:set nolist

toggle between the two and watch for shifting text to find the hidden characters. They sometimes like to hide even when visible. :)

Rod Knowlton
IBM Certified Specialist - AIX V4.3 System Administration

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top