Unix 101 : Showing non-printing characters in text files (ex : DOS files)

A non-printing character is a character which won’t actually get directly printed (or displayed) but rather interpreted. Such non-printing characters are for example line-feed or tabulation. The interpretation of those characters can differ from one system to the next. For example the line-feed character is different on Unix or DOS.

If you need an easy way to confirm that a text file is DOS or UNIX formatted (they differ with respect to the end of line character(s) for example) or if you wish to display normally non-printing characters of a text file, you can use the -vET command line switches of the cat utility.

As explained in the man page :

  • -v : will use the ^ and M- notation for control and multibytes characters
  • -E : will make ends of lines visible
  • -T : will make tabulations visible

For example : Continue reading Unix 101 : Showing non-printing characters in text files (ex : DOS files)