m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Take command line arguments to generate an awk script


From: Grant Taylor
Subject: Re: Take command line arguments to generate an awk script
Date: Sat, 24 Nov 2018 23:30:47 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 11/24/18 10:03 AM, Peng Yu wrote:
Hi,

Hi,

I'd like to generate the following awk script, where an array of number (such as 1,3 in the following example) should be taken from the command line. I am not familiar with m4 to make this work especially for an array in the command line argument.

I think you will need to define a macro on the command line and then use it in the m4 file.

m4 --define=MACRO=value example.m4

--8<--example.m4--8<--
You passed "MACRO" as the value to M`'ACRO.
-->8-->8-->8-->8-->8--

Could anybody help show me a working m4 example to generate an awk script like this? Thanks.

I don't understand enough about your request to be able to interpret your needs. Specifically:

· I don't know if the number of command line parameters is variable or fixed. · I don't know if or how the AWK file changes based on what is passed to m4. · I would like to see hypothetical input and desired output of both m4 and AWK.



--
Grant. . . .
unix || die

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]