If I have an m4
script with many commands:
define(this, that)
define(or,this)
define(other,thing)
And I call:
$: m4 script.m4 my_file
The output is:
# N newlines for the N commands in the script
# first line of my file
Is it possible to suppress the N newlines
resulting from the script read-in when calling m4
, or do I have to wrap this in some set of calling commands (like sed
or grep
)?
You can use the dnl
macro to delete new lines for define
s. E.g. from this tutorial:
The define macro itself – including its two arguments – expands to an empty string, that is, it produces no output. However the newline at the end of the AUTHOR definition above would be echoed to the output. If a blank line added to the output is a problem then you can suppress it using the “delete to newline” macro:
define(AUTHOR, W. Shakespeare)dnl
There is no space between the end of the macro and the dnl: if there were then that space would be echoed to the output.