regex = "\\.*0+$";
subst = "";
system("echo "id "| awk '{sub(\\.*0+$," subst"); print}'");
It is giving the following error:
awk: cmd. line:1: {sub(\.*0+$,); print}
awk: cmd. line:1: ^ backslash not last character on line
I tried this one as well
system("echo "id "| awk '{sub("regex"," subst"); print}'");
and This is also no worky.
str="echo " id " | awk '{sub(" regex "," subst "); print;}'" ; str | getline check;
This is giving me same exception
awk: cmd. line:1: {sub(\.*0+$, ); print}
awk: cmd. line:1: ^ backslash not last character on line
But, on the command line, this function is working fine.
echo 444000 | awk '{sub("\\.*0+$",""); print}' -> 444