From 0b8f58631c4701797a2780503b076088d276743e Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 4 Aug 2024 23:39:40 -0500 Subject: [PATCH] cs-3424: correct all count for assign 3 --- .../Assignments/Assignment-3/src/assign3.awk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Summer-2024/CS-3424/Assignments/Assignment-3/src/assign3.awk b/Summer-2024/CS-3424/Assignments/Assignment-3/src/assign3.awk index f6816c2..15b9429 100755 --- a/Summer-2024/CS-3424/Assignments/Assignment-3/src/assign3.awk +++ b/Summer-2024/CS-3424/Assignments/Assignment-3/src/assign3.awk @@ -8,7 +8,6 @@ BEGIN { newestFileDate=0 newestFileTime=0 totalUsers=0 - totalRegFiles=0 totalHidFiles=0 totalOthers=0 totalBytes=0 @@ -53,7 +52,6 @@ BEGIN { oldestFileDate=date oldestFileTime=time } - totalRegFiles++ } } else { data[user]["others"]++ @@ -64,6 +62,7 @@ BEGIN { totalBytes+=$5 } END { + totalAll=0 for (user in data) { if (isarray(data[user])) { all=data[user]["all"] @@ -77,6 +76,8 @@ END { hidden=(hidden ? hidden : 0) bytes=(bytes ? bytes : 0) + totalAll+=all + printf "Username: %s\n", user if (all > 0 ) { printf " Files:\n" @@ -97,14 +98,14 @@ END { } printf "Oldest file:\n" - printf " %s\n", oldestFile + printf " %s\n", oldestFile printf "Newest file:\n" - printf " %s\n", newestFile + printf " %s\n", newestFile printf "\n" printf "Total users: %d\n", totalUsers - printf "Total Files:\n" - printf " (All / Hidden): ( %d / %d )\n", totalRegFiles, totalHidFiles + printf "Total files:\n" + printf " (All / Hidden): ( %d / %d )\n", totalAll, totalHidFiles printf "Total directories: %d\n", totalDirs printf "Total others: %d\n", totalOthers printf "Storage (B): %d bytes\n", totalBytes