To specify which characters should be mapped into what, we create a file that contains a charmap character map, and give that file to the filter command.
> filter in.dat -output=out.dat -map=mymap.charmapwill apply the character mappings specified in the file mymap.charmap to the file in.dat, and write the result to the file out.dat .
The rest of this page describes the syntax for charmap files.
# Example: mymap.charmap
# Map curly brackets to parentheses, and hash marks to dollar signs
"{}#" -> "()$"
# Convert lower case a-z to upper case
"abcdefghijklmnopqrstuvwxyz" ->
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
# Map all printing characters over octal 177 to question marks.
" ¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿" -> "?" # non-breaking space, soft hyphen
"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß" -> "?"
"àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" -> "?"
# Remove all control characters
'\000\001\002\003\004\005\006\a\010\t\n\v\f\r\016\017\020' -> ""
'\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\177' -> ""
'\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217' -> ""
'\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237' -> ""
# Example: mymap.charmapComments start with a # character that is not inside a quoted string, and continue to the end of the line. They do not have to be the first thing that appears on the line, so this is okay as well:
" ¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿" -> "?" # non-breaking space, soft hyphen
"{}#" -> "()$"
The two strings on either side of the -> token are the
same length. The first character in the left hand string is mapped to
the first character of the right hand string, the second to the
second, etc.
The strings can be enclosed in either single or double quotes. See Quoted String Syntax for further details.
"abcdefghijklmnopqrstuvwxyz" -> "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß" -> "?"
'\000\001\002\003\004\005\006\a\010\t\n\v\f\r\016\017\020' -> ""
"abcdefghijklmnopqrstuvwxyz" -> "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "i" -> "i"Makes upper case of all the English alphabet letters except "i", which is left in lower case.
This means that an empty file counts as a valid charmap that leaves all characters as they were.