awk(2)
1.awk的三种形式
awk '{comman}' inputfile
awk -F "sparator" '{command}' inputfile awk -f awkfile inputfile
2.awk的默认分隔符是空格。
3.在awk中可以打印报告头和报告尾,其格式为
awk -F ";" 'BEGIN{print "HELO world"} {print $1} END{print "BYE world"} ' inputfile
4.awk中if语句及正则表达式的几种应用形式
awk '/[Gg]reen/' grade.txt awk '$1 ~ /[Gg]reen/' grade.txt (找出$1匹配正则表达式的行) awk '{if($1>=100) print "Helo"}' grade.txt awk '$1~/(Yellow|Brown)/' grade.txt (配置Yellow或Brown的行)
相关推荐
chenpro 2020-07-04
fendou00sd 2020-06-16
RealJianyuan 2020-06-14
cwgxiaoguizi 2020-06-05
chenpro 2020-06-02
Neptune 2020-05-31
老谢的自留地 2020-05-09
YukiRain 2020-05-08
baobaozai 2020-04-29
Proudoffaith 2020-04-08
fenxinzi 2020-03-01
zhiliang 2020-01-31
wannagonna 2020-01-13
wandererdl 2019-12-25
chenchuang 2020-01-25
jyj00 2020-01-09
fendou00sd 2020-01-07
fendou00sd 2020-01-06
PHP学习笔记 2020-01-06