//Tips tagged m4
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
The m4 command is designed specifically for macro processing. m4 manipulates files, performs arithmetic, has functions for handling strings, and can do much more.
Here's a quick example of using m4 with templates:
Were you to substitute the strings 'COLOR' by 'brown' and 'TYPE' by 'lazy', you could use:
Else, if you want to substitute 'white' and 'big' for the same:
Here's a quick example of using m4 with templates:
$ cat temp The COLOR fox jumped over the TYPE dog.
Were you to substitute the strings 'COLOR' by 'brown' and 'TYPE' by 'lazy', you could use:
$ m4 -DCOLOR=brown -DTYPE=lazy temp The brown fox jumped over the lazy dog.
Else, if you want to substitute 'white' and 'big' for the same:
$ m4 -DCOLOR=white -DTYPE=big temp The white fox jumped over the big dog.

