标签:awk sed grep
#!/bin/bash h=`hostname` echo "Hostname is $h" ifconfig -a >/tmp/ip.tmp for eth in `grep ‘Link encap:‘ /tmp/ip.tmp|awk ‘{print $1}‘` do ip=`grep -A1 "$eth" /tmp/ip.tmp|tail -1 |awk ‘{print $2}‘|sed ‘s/addr://‘` echo $eth":"$ip done echo "The DNS IP is:" grep ‘nameserver‘ /etc/resolv.conf|awk ‘{print $2}‘
本文出自 “Linux_Config” 博客,请务必保留此出处http://jialiang1026.blog.51cto.com/10119067/1632177
标签:awk sed grep
原文地址:http://jialiang1026.blog.51cto.com/10119067/1632177