Git init
[external/mawk.git] / msdos / examples / objstat.awk
1 # Ben Myers <0003571400@mcimail.com>
2
3 # Sum up sizes of OBJ files in current directory
4 # A clumsy script to count OBJs and sum up their sizes
5 # run with 
6 #       bmawk -fobjsize.awk workfile
7 # or similar command syntax with your awk program
8 # where workfile is a work file
9 BEGIN {
10 # redirection done by shelled command
11 system("dir *.obj >" ARGV[1])
12 osize = 0   # size accumulator
13 ocount = 0  # obj counter
14 }
15 # Now read workfile back, skipping lines that are not files
16 $2 == "OBJ" { osize += $3 ; ocount++ }
17 END {
18 print ocount " OBJs, total size " osize " bytes"
19 system("del "ARGV[1])
20 }