Separa as interfaces e seus IP’s em uma única linha, separados por vírgula!

# SUSE=`grep -i suse /etc/issue`; echo ""; if [ ! -z "$SUSE" ]; then ip a | egrep 'inet [0-9][0-9][0-9].[0-9][0-9][0-9]' | awk -F " " '{if ($7 == "secondary") print $8 "-" $2; else print $7 "-" $2}' | cut -d / -f 1 | sed 's/^/"/g' | sed 's/$/",/g' | sed ':a;$!N;s/\n//;ta;'| sed 's/,$//g' ; echo ""; else IFACE=`ifconfig | grep ^eth | cut -d ' ' -f 1`; for x in $IFACE; do echo -n "\"$x-`ifconfig $x | egrep addr:[0-9][0-9][0-9].[0-9][0-9][0-9]. | awk -F " " '{print $2}' | cut -d : -f 2`\" "; done; echo -e "\n"; fi

Leave a Reply