说明: awk被设计用于数据流,能够对列和行进行操作。而sed更多的是匹配,进行替换和删除。 awk有很多内建的功能,比如数组,函数等。灵活性是awk的最大优势。 awk的结构 awk ' BEGIN{ print "start"} pattern { commands } END{ print "end"}' file 为
法1:cut [root@oldboy oldboy]# ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1 10.0.0.162 法2:awk [root@oldboy oldboy]# ifconfig eth0|grep 'inet addr'|awk -F ":&
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号