- 论坛徽章:
- 0
|
本帖最后由 xmi 于 2011-02-14 13:55 编辑
回复 xmi
第二个结果是这个么?
yinyuemi 发表于 2011-02-14 13:37
1.awk -F"'" 'BEGIN{"header1","header2","header3","header4"}/event/{a[$2"\t"substr($3,5)]=++b[$3]}END{for(i in a) print i
"\t"a|"sort -n "}' log
2. awk -F "'| " 'BEGIN{print "lequipmentlocation: USA"} /event/ {a["event code: "$NF]>0?a["event code: "$NF]="\n"$1"\t"$(NF-4):a["event code: "$NF]=a["event code: "$NF]"\n" $1"\t"$(NF-4)}END{for (i in a) print i, a"\n"}' file
![]()
1.
% awk -F"'" 'BEGIN{"header1","header2","header3","header4"}/event/{a[$2"\t"substr($3,5)]=++b[$3]}END{for(i in a) print i
"\t"a|"sort -n "}' log
awk: syntax error near line 1
awk: illegal statement near line 1
2.
你个是我想要做到的, 但我这儿一行就出了以下error:
%awk -F "'| " 'BEGIN{print "lequipmentlocation: USA"} /event/ {a["event code: "$NF]>0?a["event code: "$NF]="\n"$1"\t"$(
NF-4):a["event code: "$NF]=a["event code: "$NF]"\n" $1"\t"$(NF-4)}END{for (i in a) print i, a"\n"}' log
awk: syntax error near line 1
awk: bailing out near line 1
% |
|