#1. Awk's search function
Ifconfig |awk '/bc/' |awk-f: ' {print $} ' |awk ' {print '} '
#2. Cut specify a separator
Ifconfig |sed-n 2p|cut-d:-f2|cut-d ""-f1
#3. Head,tail commands are easy to combine
Ifconfig |head-2 |tail-1|sed ' s#^.*dr:\ (. *\) bca.*$#\1# '
#4. The Replace function of SED
Ifconfig |sed-n 2p|sed ' s#^.*dr:\ (. *\) B.*$#\1#g '
#5. grep filters The specified rows
Ifconfig |grep "Bcast" |cut-c 21-36
The-c option of the #6. Cut command is applied
Ifconfig |awk ' Nr==2{print $ ' |cut-c 6-
#7. awk's ability to print line numbers
Ifconfig |awk ' Nr==2{print "|cut-d": "-f2
#8. The delete function of sed and the replacement function of TR
Ifconfig |sed ' 3, $d ' |sed 1d|tr ":" \ n "|grep b|tr" "\ n" |head-1
#9. TR Replace whatever you want, instead of what you change.
Ifconfig |sed-n 2p|tr "Bcast" ": Bcas" |cut-d:-f2
#10. Awk's search function plus TR replacement function
Ifconfig |awk '/bc/' |tr "B" ":" |cut-d:-f2
#11. The replacement of SED
Ifconfig |sed-n 2p|sed ' s/b/:/g ' |cut-d:-f2
Ifconfig |sed-n 2p|sed ' s/:/@/g ' |sed ' s/b/@/g ' |cut [email protected]-f2
#12. SED replacement and awk combination
Ifconfig |sed-n 2p|sed ' s/:/@/g ' |sed ' s/b/@/g ' |awk [email protected] ' {print $} '
#13. sed search function and awk's multi-delimiter function
Ifconfig |sed-n '/bc/p ' |awk-f [:, ' "] ' {print $13} '
#14. AWK supports extended regular expressions
Ifconfig |sed-n '/bc/p ' |awk-f [:, ' "]+ ' {print $4} '
#15. SED first search and replace function
Ifconfig |sed-n '/bcast/s/^.*dr:\ (. *\) BC.*$/\1/GP '
#16. grep's-n option means that the line number is printed, the-I option is case-insensitive, and the line number allows us to filter.
#加行号还有ifconfig |cat-n|nl|grep-in BC
#打印匹配行的行号和内容 ifconfig |sed-n-E '/bca/= '-e '/bca/p ' awk nr features
#统计行号 more complex a= ' ifconfig |sed ' = ' |wc-l '; echo $ ((A/2))
#统计行号 the simplest ifconfig |wc-l
#把修改好的内容保存到一个文件 ifconfig |sed-n 2p|sed ' s/bcast//w sed '
Ifconfig |grep-ni bcast|cut-d:-f3|awk ' {print $} '
#17. grep and TR command combinations
Ifconfig |grep-i bcast|tr "B" "\ n" |head-1 |tr ":" \ n "|grep ^[0-9]
#18. The same 151 main exercises regular expressions
Ifconfig |grep-i bcast|tr "B" "\ n" |head-1 |tr ":" \ n "|grep--color=auto [0-9$]
#19. The delete function of SED
Ifconfig |sed-n 2p|sed ' s/^.*dr://' |sed ' s/bc.*//'
#20. The SED-E option is used here to allow multi-point editing.
Ifconfig |sed-n-E '/bca/= '-e '/bca/p ' |awk-f [:, ' "]+ ' {print $4} '
#21. The design of the knowledge point: Partial replacement, to save the modified content to a file.
Ifconfig |sed-n 2p|sed ' s/bcast//w 2.txt ' |cut-d:-f2
This article is from the "12554489" blog, please be sure to keep this source http://12564489.blog.51cto.com/12554489/1910071
20 ways to intercept IP in Linux