I have two Linux machines. One is 4.4.12-99, one is 4.4.143. I just ran apt upgrade on them both.
I have an awk statement that contains a regex that works on 4.4.143, but fails on 4.4.12-99. I have searched for days and tried multiple different syntaxes to discover what can be wrong. awk is not failing or complaining, it's just not matching the word boundary. The scripts are the same on each machine and work fine except for this awk statement. On the one that is not working properly, I can cause it to match everything and provide that result.
ip=$(awk -v sUSER="$sUSER" 'BEGIN{gsub(/\./,"\\.",sUSER)}match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) && $0 ~ ("[^[:alnum:]]"sUSER"$") && $0 !~ /^$/ && $0 !~ /^#/{print $1}' /etc/hosts )
awk looks into the /etc/hosts file with a variable, $sUSER and tried to match a user to an associated IP address.
I cant figure out what I am doing wrong.