????????awk????????
?????????awk??????????????????????????????е??????????????????ε???????????[tab]??
???????awk????????????
????awk 'BEGIN{print "start"} pattern {commands} END{print "ends"}' file // ???awk?????????BEGIN???顢??????????????????顢END????3????????????????????????????????????????????????
????//???????????????????????
???????磺 awk 'BEGIN{i=0}{i++}END{print i}' filename
????awk "BEGIN{i=0}{i++}END{print i}" filename
????????awk????й???
????awk 'BEGIN {commands} pattern{commands}END{commands}' filename
????[1]??????????BEGIN{commands} ?????е????
????[2]????????????????????stdin???????У???????pattern{commands}???飬??????????????????е???????????????????????????????????
????[3]?????????????????????β??????END{commands}????
????BEGIN??????awk????????????ж??????????У????????????????顣???????????????????????????????????????д??BEGIN?????С?
????END??????awk????????????????е????????У????????????е???????????????????????END????????ɡ?
????????awk???????
????[1]$n ?????е??????????????????????[TAB]]??????????n????Σ?????n?1 ?????1????Σ?n?2?????2?????
????[2]$0 ??????????й????е???е????????
????[3]NF ????($0)??е????????
????[4]NR ??awk???????"?????"????
????[5]FNR ???????????????????"?????"????
????[6]FS ???????????????????FS????????????????
????[7]OFS ?????ε?????????????????
????[8]ORS ????????????????????????У?
????[9]ARGIND ???????д???????????λ?????1?????
????[10]ARGC ?????в????????
????[11]ARGV ?????в?????????
???????awk???
??????1??pay.txt?????????:????????????1??????????1???????????1????????????????1????????????
????Name     1st      2nd         3th
????VBird     2300   3400      2500
????Bmtsai   2000   2000      2300
????Bird2     4300   4200      4100
????????awk 'NR==1{printf ("%10s%10s%10s%10s%10s "?? $1?? $2?? $3?? $4??"Total")} NR>=2{total=$2+$3+$4; printf ("%10s%10s%10s%10s%10s "?? $1?? $2?? $3?? $4??total)}' pay.txt
?????????

?????????NR??????????????????к???????????NR==1????????????е?????Name 1st 2nd 3th????к?????????е?????printf?????????????NR>=2???????е?????????е?????{total=$2+$3+$4; printf
????("%10s%10s%10s%10s%10s "?? $1?? $2?? $3?? $4??total)}???????awk???????е?pattern????????????????????????????commands??
??????2????a.dat??????????????????????
????a.dat?????    b.dat?????

???????? awk 'BEGIN{i=0;j=0}FNR==NR{array[i++]=$1;next}{total=array[j]+$1;print array[j]??$1??total;j++}' a.dat b.dat
??????awk 'BEGIN{i=0;j=0}ARGIND==1{array[i++]=$1}ARGIND==2{total=array[j]+$1;print array[j]??$1??total;j++}' a.dat b.dat
????????????



 

?????????NR??FNR??awk?????????????к??NR??????????????????FNR?????????????????????????awk???????????????????????????????????????????????????NR              ?????????????????????????FNR???????????????
????????????????????????????????????У????????????????????????????????????????????????????
??????3???????????——????????test.da??????£?

 

????????awk ' !a[$0]++{print $0}' test.da
?????????

?????????awk?????????????0?????????????????????a?е???????!a[$0]?????????????к????print $0