Comment 67 for bug 1452202

Revision history for this message
Hua Zhang (zhhuabj) wrote :

Maybe we can use the following regex instead, 'awk '$1 ~ /^127|localhost/ {print $0}'' is used to fix 'ff02::1 ip6-allnodes' case, and add 'g' option to modifity all hostname.

$ hostname=ubuntu
$ echo '127.0.1.1 ubuntu.me.com ubuntu' |awk '$1 ~ /^127|localhost/ {print $0}' |sed "s/\s*\(${hostname}\)\(\s*\)/\tnewnode/g"
127.0.1.1 newnode.me.com newnode

Addition, also need to remove "f ! echo "$RET" | grep -q 'ubuntu';" as Peter Wu said above