1 # Ben Myers <0003571400@mcimail.com>
3 # Sum up number, line count, and sizes of SOURCE files in current directory
5 # bmawk -fsrcsize.awk workfile
6 # or similar command syntax with your awk program
7 # where workfile is a work file
9 # redirection done by shelled command
10 system("dir *.* >workfile")
11 ssize = 0 # size accumulator
12 slines = 0 # line counter
13 scount = 0 # obj counter
17 # Now read workfile back in
18 while (getline < "workfile" > 0) {
19 if ($2 == "C" || $2 == "H" || $2 == "CPP" || $2 == "HPP") {
20 filename = sprintf("%s.%s", $1, $2)
22 while (getline < filename > 0) {slines++}
26 print scount " files, " slines " lines, total size " ssize " bytes"
27 system("del workfile")