$ type grep
grep is /bin/grep

$ type awk
awk is /usr/bin/awk

The PATH is set in /etc/profile or /etc/bashrc that were run when you opened the command shell. That PATH is probably different from the active PATH during boot. When you run the script from the command line, you may be fooled by that. It seems that /bin is in the PATH during boot (the script finds grep) , but /usr/bin is not (awk not found).

Try to put the entire output from ifconfig into a file. That should show if the MAC address is known at the time or not.