[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How do I pass an arbitrary value to awk?
From: |
Yuri Kanivetsky |
Subject: |
How do I pass an arbitrary value to awk? |
Date: |
Thu, 20 Apr 2023 03:07:12 +0300 |
Hi,
As far as I can see variables passed via command line are preprocessed:
https://www.gnu.org/software/gawk/manual/html_node/Assignment-Options.html
and to pass an arbitrary value one needs to only escape backslashes:
v='...'
v=`echo "$v" | sed -E 's/\\/\\\\/g'`
awk PROGRAM "n=$v" INPUT
Right?
Regards,
Yuri
- How do I pass an arbitrary value to awk?,
Yuri Kanivetsky <=