File: objstat.awk

package info (click to toggle)
mawk 1.3.3-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,204 kB
  • ctags: 1,530
  • sloc: ansic: 13,023; yacc: 994; awk: 629; sh: 330; makefile: 164
file content (20 lines) | stat: -rw-r--r-- 586 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Ben Myers <0003571400@mcimail.com>

# Sum up sizes of OBJ files in current directory
# A clumsy script to count OBJs and sum up their sizes
# run with 
#       bmawk -fobjsize.awk workfile
# or similar command syntax with your awk program
# where workfile is a work file
BEGIN {
# redirection done by shelled command
system("dir *.obj >" ARGV[1])
osize = 0   # size accumulator
ocount = 0  # obj counter
}
# Now read workfile back, skipping lines that are not files
$2 == "OBJ" { osize += $3 ; ocount++ }
END {
print ocount " OBJs, total size " osize " bytes"
system("del "ARGV[1])
}