ccp 1.2 - reCoding CoPy (GPLed)

ccp can copy stdin or file to stdout, file to file, or files to directory, including recursive copying of directories. While copying, it can apply one or several recodings. A recoding maps each byte to one or several (e.g., zero) bytes. Recoding tables are read from files. A recoding table can be in the text form or in the binary form. You can easily write a recoding table as a text file. Binary files are usually smaller and can be loaded faster. They can be produced from text recoding files by ccp. ccp can also multiply recodings - produce a table which has the same effect as several recodings applied sequentially. This multiplication is, of course, not commutative.

The base distribution contains recoding tables for converting DOS text files to Unix text files and back (d2u and u2d), conversions between russian encodings koi8-r, alt (cp866), win (cp1251), iso-8859-5, LaTeX (T2A) in any direction (k2a, i2k, a2w, k2l, etc.), for converting these encodings to transliteration (recodings k2t, etc.), and for filtering out control characters (recoding c).

Some typical examples of use:

You can easily write your own recoding tables. Here is an example:

# This is a comment
'a' -> 'b'
0F -> 0A # hexadecimal
'x' -> 'uvw'
'y' ->
# y is recoded to nothing
1A -> 2A2B2C # hexadecimal
"z" -> "abc" # "z" and 'z' are equivalent
"'" -> '"' # ' is recoded to "
If you call this file code.16 you can use
ccp -code foo bar
You can also compile the text file code.16 into a binary form code :
ccp -code =code
Several options may be combined:
ccp -code1 -code2 =code12 +code3 foo bar
means take recoding code1, multiply it by code2, store the result in code12, then multiply by the recoding inverse to code3 and copy foo to bar using the resulting recoding.

You can specify a list of directories where to search for recoding tables via the environment variable CCPPATH. They are separated by :. By default, /usr/share/ccp:. is used. In each directory, ccp first tries to find the binary form; if not successful, then the text form with the extension .16

Download: ccp-1.2.tar.gz (11K), ccp-1.2-1.i686.rpm (18K), ccp-1.2-1.src.rpm (13K) (rpms are for Red Hat Enterprise Linux 4).