find . -type f -exec grep '%%' {} \; | perl -ne '@x =m!.+%%([\/\w]*)%%.+$!xmi; printf "%s\n", $x[0] if $x[0] !~ /^\s*$/;' | sort | uniqand then making markers for all the variables in the cdd
$ cat LegacyEvents.cdd | perl -ne '@x =m!(.+)%%([\/\w]*)%%(.+)$!xmi; if (@x) { printf "%s\$\{%s\}%s\n", $x[0], $x[1], $x[2];} else { print $_; }'