ditto [-c chars] [-p] [-s regexp] [inputfile ...]
Humdrum null-tokens are place-holders that do not themselves encode data. Null-tokens consist of a single period character (".") -- separated from other tokens by tabs, or appearing on a line by itself. The ditto command replaces occurrences of null-tokens with the most recent non-null data occurring in the same spine. When the -p option is invoked, the replacement data tokens are enclosed in parentheses ( ). If the initial data tokens in a spine are null-tokens, then null-tokens are output.
In repeating previous data tokens, if the -s option is invoked, ditto skips over any data records matching regexp. For example, if regexp is the equals-sign (the "common system" barline), then barline data tokens will not be repeated in subsequent data records containing null tokens. Thus, if a data token `X' is followed by a token that matches the regular expression /=/, then subsequent null-tokens will be replaced by the token `X' rather than by the equals sign.
The ditto command correctly handles spine path changes. In the case where two or more spines join together, ditto outputs a multiple-stop where necessary.
Options are specified in the command line.
-h displays a help screen summarizing the command syntax -c chars repeats only characters listed in chars -p place repeated data tokens in parentheses -s regexp skip data records matching regexp
Invoking the command:
!! Example 1 **kern **kern 16e- 8r 16d . 16e- 8gg 16f . 16g 8cc 16f . 16g 8gg 16e- . 16a [2aa 16g . 16a . 16b- . 16cc . 16b- . 16cc . 16a . =78 =78 . . *- *-
ditto input > output
produces the following output:
!! Example 1 **kern **kern 16e- 8r 16d 8r 16e- 8gg 16f 8gg 16g 8cc 16f 8cc 16g 8gg 16e- 8gg 16a [2aa 16g [2aa 16a [2aa 16b- [2aa 16cc [2aa 16b- [2aa 16cc [2aa 16a [2aa =78 =78 =78 =78 *- *-
The following, more complex example, illustrates the use of the -p and -s options. The input is shown on the left and the corresponding output is shown on the right. The output was produced by invoking the following command:
ditto -p -s ^= input > output
INPUT OUTPUT !! Example 2 !! Example 2 **foo **foo **bar **foo **foo **bar a xyz . a xyz . . 23 (%&) (a) 23 (%&) =2 =2 =2 =2 =2 =2 . . . (a) (23) ((%&)) !! A comment. !! A comment. . . 49 (a) (23) 49 *x * *x *x * *x . . . (49) (23) (a) * *v *v * *v *v . . (49) (23 a) abc XYZ abc XYZ * *^ * *^ . . . (abc) (XYZ) (XYZ) . 1a 2b (abc) 1a 2b =3 =3 =3 =3 =3 =3 *- * * *- * * . . (1a) (2b) ==== ==== ==== ==== *+ * *+ * **foo **foo **bar **foo **foo **bar . . . (1a) . (2b) *- *- *- *- *- *-
A final example illustrates the use of the -c option. Once again, the input is shown on the left and the corresponding output is shown on the right. The output was produced by invoking the following command:
ditto -c '[a-gA-G#-]' input > output
INPUT OUTPUT **kern **kern **kern **kern (4g 8b (4g 8b . 8cc g 8cc 8f# 4dd 8f# 4dd 4.g) . 4g) dd . 8cc g 8cc . 8b g 8b 4d 4a 4d 4a . . d a *- *- *- *-
pitch signifiers, without propagating non-pitch information.