bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] How to take regexp constant from command line?


From: arnold
Subject: Re: [bug-gawk] How to take regexp constant from command line?
Date: Sun, 18 Nov 2018 03:49:56 -0700
User-agent: Heirloom mailx 12.4 7/29/08

Peng Yu <address@hidden> wrote:

> Hi,
>
> I am not able to take a regexp constant from the command line. Is
> there a way to do so? Thanks.
>
> awk -v 'y=@/xyz/' -e 'BEGIN { x= @/abc/; print typeof(x);print x; print y }'
>
> -- 
> Regards,
> Peng

This cannot be done at the moment. I will see if I can make it work.

In the meantime you can assign a string to a variable and use that
varible with the ~ and !~ operators, but you have to be careful with
the backslashes if you need any in your pattern.

Thanks for the report!

Arnold



reply via email to

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