diff --git a/tools/examples/vif-common.sh b/tools/examples/vif-common.sh index 18a0b6c88e..105a843900 100644 --- a/tools/examples/vif-common.sh +++ b/tools/examples/vif-common.sh @@ -113,7 +113,7 @@ function handle_iptable() # function ip_of() { - ip addr show "$1" | sed -n 's/^.*inet \([0-9.]*\).*$/\1/p' + ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed 's,/.*,,' }