瀏覽代碼

awk: add print every nth line example (#2008)

Sinan 7 年之前
父節點
當前提交
2926835dd6
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      pages/common/awk.md

+ 4 - 0
pages/common/awk.md

@@ -21,3 +21,7 @@
 - Sum the values in the first column and pretty-print the values and then the total:
 
 `awk '{s+=$1; print $1} END {print "--------"; print s}' {{filename}}`
+
+- Print every third line starting from the first line:
+
+`awk 'NR%3==1' {{filename}}`