Detect-control-characters

From PTAGISWiki

Jump to: navigation, search

A simple method for detecting control characters in a text file is to run it through this filter:

cat -v | grep '\^'

The 'cat -v' will make control characters visible by prepending a circumflex to them. The grep command then searchs for that circumflex. The backslash is necessary to tell grep to search for a literal circumflex instead of the beginning of a line, which the circumflex metacharacter stands for.

This method will not detect \n (newlines) or other normal unix whitespace.

Another useful tool for analyzing control-characters is the 'od' command especially in the form of 'od -c' to interpret the octal results as ascii characters.

Personal tools