I’m using awk to urldecode some text.
If I code the string into the printf statement like printf "%s", "\x3D" it correctly outputs =. The same if I have the whole escaped string as a variable.
However, if I only have the 3D, how can I append the \x so printf will print the = and not \x3D?
I’m using busybox awk 1.4.2 and the ash shell.
Since you’re using ash and Perl isn’t available, I’m assuming that you may not have
gawk.For me, using
gawkor busybox awk, your second example works the same as the first (I get “=” from both) unless I use the--posixoption (in which case I get “x3D” for both).If I use
--non-decimal-dataor--traditionalwithgawkI get “=”.What version of AWK are you using (
awk,nawk,gawk, busybox – and version number)?Edit:
You can coerce the variable’s string value into a numeric one by adding zero: