Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 418 Bytes

2019_07_06_the_awk_programming_language.md

File metadata and controls

21 lines (14 loc) · 418 Bytes

The AWK Programming Language

  • TODO
  • https://github.com/wuzhouhui/awk

关联数组

假设 logfile 就是一堆 ip
1.2.3.4
2.3.1.3
...

awk '{count[$1]++;} END{for (var in count) {print var" = "count[var]}' logfile
统计 ip 出现的次数。

if ("key" in map)         <--  要这样来判断 key 是否存在,不能写 if (map["key"] == "value") ...