Gema is described as 'general purpose text processing utility based on the concept of pattern matching. In general, it reads an input file and copies it to an output file, while performing certain transformations to the data as specified by a set of patterns defined by the user'. There are more than 10 alternatives to Gema for a variety of platforms, including Linux, Windows, Mac, BSD and Haiku. The best alternative is Perl, which is both free and Open Source. Other great apps like Gema are GCC C Preprocessor (cpp) (Free, Open Source), GNU sed (Free, Open Source), GPP (Free, Open Source) and PP - A generic Preprocessor (Free, Open Source).
P is a text preprocessor designed for Pandoc (and more generally Markdown and reStructuredText). PP implements: - macros - literate programming - GraphViz, PlantUML and ditaa diagrams - Bash, Cmd, PowerShell, Python and Haskell scripts.
GNU M4 is an implementation of the m4 macro preprocessor. Developed by the GNU Project, GNU M4 is designed to avoid many kinds of limits found in traditional m4 implementations, such as maximum line lengths, maximum size of a macro and number of macros
filepp is a generic file preprocessor. It is designed to allow the functionality provided by the C preprocessor to be used with any file type. filepp supports the following keywords, all of which have their usual C preprocessor meanings and usage.