10.9. Displaying control characters in a file

When downloading files from other systems, you sometimes get control characters (non-printable characters) spread all over the file. Capturing an application screen output from a menu can sometimes cause control characters to be put in a file. How can you tell if there are any in a file? If you do ‘ cat -v filename ’, and the screen bleeps and spurts rubbish everywhere, then be assured you’ve got control characters in that file. If you get funny looking characters being displayed then be pretty sure that they are control characters as well.

On some systems you can do just a ‘ cat filename ’ instead of cat -v to see all those non-printable characters.

The sed format is:

[address,[address]]l 

where ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.