File: awc.awk

package info (click to toggle)
goawk 1.29.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 10,560 kB
  • sloc: awk: 3,060; yacc: 198; fortran: 189; python: 131; sh: 58; makefile: 12
file content (17 lines) | stat: -rw-r--r-- 478 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN {
  for (i = 1; i < ARGC; i++) {
    if (ARGV[i] == "--") {
      delete ARGV[i++]
      break
    }
    else if (ARGV[i] !~ /^-./) break
    else if (ARGV[i] == "-c") c = 1
    else if (ARGV[i] == "-w") w = 1
    else if (ARGV[i] == "-l") l = 1
    else printf "awc: unknown option: %s\n", ARGV[i] >"/dev/stderr"
    delete ARGV[i]
  }
  if (!c && !w && !l) c = w = l = 1
}
{ cs += length(); ws += NF; ls++ }
END { printf "%s%s%s\n", l?ls" ":"", w?ws" ":"", c?cs" ":"" }