I need to insert contents of variable to parameter function gensub in awk, specifically instead of regular expression's parameter. Can you help me with it?
I have:
gawk '
BEGIN {
a = "abc15d56ef";
b = gensub(/.*([0-9][0-9])d([0-9][0-9]).*/, "\\2 \\1", "g", a);
print b;
}'
output
output:56 15
I need it to be in this form, but it doesn't work:
gawk '
BEGIN {
a = "abc15d56ef";
c="/.*([0-9][0-9])d([0-9][0-9]).*/";
b = gensub(c, "\\2 \\1", "g", a);
print b;
}'
output
output:56 15