mirror of
https://github.com/ThomasDickey/mawk-snapshots.git
synced 2026-01-29 20:34:30 +00:00
27 lines
723 B
Awk
27 lines
723 B
Awk
# Ben Myers <0003571400@mcimail.com>
|
|
|
|
# Sum up number, line count, and sizes of SOURCE files in current directory
|
|
# run with
|
|
# bmawk -fsrcsize.awk workfile
|
|
# or similar command syntax with your awk program
|
|
# where workfile is a work file
|
|
BEGIN {
|
|
# redirection done by shelled command
|
|
# system("dir *.* >workfile")
|
|
system("dir *.* >" ARGV[1])
|
|
ssize = 0 # size accumulator
|
|
slines = 0 # line counter
|
|
scount = 0 # obj counter
|
|
}
|
|
# Now read workfile back in
|
|
$2 == "C" || $2 == "H" || $2 == "CPP" || $2 == "HPP" {
|
|
filename = sprintf("%s.%s", $1, $2)
|
|
ssize += $3
|
|
while (getline < filename > 0) {slines++}
|
|
scount++
|
|
}
|
|
END {
|
|
print scount " files, " slines " lines, total size " ssize " bytes"
|
|
system("del " ARGV[1])
|
|
}
|