Thank you for your awesome scripts.
But, your script doesn't work as I thought.
Both static and dhcp can have dns-nameservers.
But below example command didn't working.
awk -f changeInterface.awk /etc/network/interfaces dev=eth0 mode=dhcp dns=210.220.163.82
I think that in case of dhcp, your script didn't set dns.