Cover V05, I07
Article
Listing 1
Listing 2
Listing 3
Sidebar 1
Table 1
Table 2

jul96.tar


Listing 3: dumpsize.nawk

#
# @(#) dumpsize.nawk v1.0 940528 BJA
#
BEGIN {
DEBUG = 0;
}
#
# Search non-empty lines
#
/.*/ {
#
#  Host name
#
pos = index($0, "HOST");
if (pos > 0) {
if (DEBUG) {
printf("DEBUG->host:%s\t", $2);
}
printf("%s\t", $2);
}
#
#  Disk name
#
pos = index($0, "Dumping");
if (pos > 0) {
if (DEBUG) {
printf("DEBUG->line:%s\t", $0);
}
pos1 = index($0, "(");
if (pos > 0) {
pos2 = index($0, ")");
len = pos2 - pos1 - 1;
printf("%s\t%s\t", $3,
substr($0, pos1+1, len));
}
else {
printf("%s\t%s\t", $3, "Unknown");
}
}
#
#  Disk size
#
pos = index($0, "volume");
if (pos > 0) {
if (DEBUG) {
printf("DEBUG->line:%s\n", $0);
}
pos1 = index($0, "(");
pos2 = index($0, ")");
len = pos2 - pos1 - 1;
diskSize = substr($0, pos1+1, len);
pos = index(diskSize, "KB");
if (pos > 0)
printf("1\n");
else {
pos3 = index(diskSize, ".");
if (pos3 > 0) {
tempSize = sprintf("%s",
substr(diskSize, 0, pos3 - 1));
diskSize = tempSize + 1;
printf("%s\n", diskSize);
}
else
printf("%s\n", substr(diskSize, 0,
length(diskSize)-2));
}
}
}

# End of File