Handling Text
m4 provides a small but useful collection of built-in text-processing macros. In addition to the format macro previously described, and the len macro occasionally mentioned in Macros with Arguments, the collection includes macros translit, index, substr, regexp, and patsubst. These macros work as follows:
The translit(str,chars[,replacement]) macro replaces (transliterates) every character in str that is also in chars with the corresponding (having the same index) character in replacement. Before transliteration, m4 shortens chars or replacement to the same length. If replacement isn’t provided, the chars are erased from the string—that is, replaced with an empty string. You can specify a character range in either argument, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access