标签:== eth family 空格 ros awk编程 file passwd etc
awk [ 切割符号 ] ‘ [ / pattern/ ] 函数语句 ‘ [ 文件名 ]
$0 全部 , $1 第一列 ,$2 第二列 ......
awk -F: ‘{print $1}‘ /etc/passw
awk -F: ‘NR==2{print "filename: "FILENAME, $0}‘ /etc/passwd
awk -F: ‘NR==2{print "filename: "$1}‘ /etc/passwd
awk -F : ‘NR==2{print "filename: "FILENAME, $0}‘ /etc/passwd
多分隔符 awk -F "[ : , /]" ‘NR==2{print "filename: "FILENAME, $0}‘ /etc/passwd
ifconfig |grep eth* | awk -F ‘[ ]+‘ ‘{print $1}‘
统计文件下的值得个数,和,平均值
awk ‘BEGIN{count=0;}{split($0,a,"\t");for(i in a){count+=a[i];times+=1;}}END{print times,count,count/times}‘ log_20191022194429
标签:== eth family 空格 ros awk编程 file passwd etc
原文地址:https://www.cnblogs.com/lovemeng1314/p/11729522.html