1# Ben Myers <0003571400@mcimail.com> 2 3# Sum up number, line count, and sizes of SOURCE files in current directory 4# run with 5# bmawk -fsrcsize.awk workfile 6# or similar command syntax with your awk program 7# where workfile is a work file 8BEGIN { 9# redirection done by shelled command 10system("dir *.* >workfile") 11ssize = 0 # size accumulator 12slines = 0 # line counter 13scount = 0 # obj counter 14exit 15} 16END { 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) 21 ssize += $3 22 while (getline < filename > 0) {slines++} 23 scount++ 24 } 25 } 26print scount " files, " slines " lines, total size " ssize " bytes" 27system("del workfile") 28} 29