Using M4 Command

This command takes an input file and substitutes strings inside it with the parameters passed, similar to substituting for variables. For example, here is an input file:

$ cat temp
The COLOR fox jumped over the TYPE fence.

Were you to substitute the strings “COLOR” by “brown” and “TYPE” by “broken”, you could use:

$ m4 -DCOLOR=brown -DTYPE=broken temp
The brown fox jumped over the broken fence.

Else, if you want to substitute “white” and “high” for the same:

$ m4 -DCOLOR=white -DTYPE=high temp
The white fox jumped over the high fence.

http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part2.html

Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published. Required fields are marked *