Anyone know how I will use awk's variable in a regular expression?
This line of code of mine is working, the value PREMS should be a variable:
awk '$1 ~ /PREMS/ { if(length(appldata)+2 >= length($1)) print $0; }' appldata=$APPLDATA /tmp/file.tmp
The value of APPLDATA variable is PREMS.
But this line is not working anymore:
awk '$1 ~ /appldata/ { if(length(appldata)+2 >= length($1)) print $0; }' appldata=$APPLDATA /tmp/file.tmp