截取字符串:
1.expr substr "$a" 1 8
2.echo $a | awk '{print substr(,1,8)}'
3.echo $a | cut -c1-8
实例:
ip=`ifconfig eth0 | sed -n "2,2p" | awk '{print substr($2,6)}'`;
1.expr substr "$a" 1 8
2.echo $a | awk '{print substr(,1,8)}'
3.echo $a | cut -c1-8
实例:
ip=`ifconfig eth0 | sed -n "2,2p" | awk '{print substr($2,6)}'`;