From 9dacca3a4a2d873b78e6396e76f841cb61243213 Mon Sep 17 00:00:00 2001 From: JayLuna12 <97865795+JayLuna12@users.noreply.github.com> Date: Fri, 3 Nov 2023 22:31:07 -0700 Subject: [PATCH 1/2] Create cs205_final_exam.sh --- cs205_final_exam.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 cs205_final_exam.sh diff --git a/cs205_final_exam.sh b/cs205_final_exam.sh new file mode 100644 index 00000000..bb9c3195 --- /dev/null +++ b/cs205_final_exam.sh @@ -0,0 +1,40 @@ +# TODO: Modify this file to create a shell script that is able to use awk to go through a file +# formatted like pokemon.dat and provides a printed report in the following format (where your +# script correctly calculates the values that go into the [VALUE] placeholders): +# ======= SUMMARY OF POKEMON.DAT ====== +# Total Non-Legendary Pokemon: [VALUE] +# Avg. HP: [VALUE] +# Avg. Defense: [VALUE] +# ======= END SUMMARY ======= + +# NOTE THAT YOU MUST USE AWK OR YOU WILL LOSE POINTS +# The "Avg." values should be calculated as mean values for the corresponding columns. +# The averages must only be for non-legendary pokemon. +# The spacing and header formatting should match the above formatting description exactly. +# There should be a comment explaining the purpose of each line in your shell script. +# The data file will be passed in to the script as a positional parameter and will not +# necessarily be called pokemon.dat. However, you can assume that any file passed to this +# script will be formatted exactly the way pokemon.dat is formatted. + +FILE=$1 + +BEGIN{FS="\t"} +{ +if (NR!=1){ + if( $13 == "True") + { + nonLegend+=1; + } + +hp+=$6 +defense+=$8 + +sum+=1 +} +} +END{ +print "======= SUMMARY OF POEKEMON.DAT =======" +print " Total Non-Legendary Pokemon: " nonLegend +print " Avg. HP: " hp/sum +print " Avg.Defense: " defense/sum +print "======= END SUMMARY ======="} From b1dfe7d4edc5b0e09d6ce11eba1931b123b2ada0 Mon Sep 17 00:00:00 2001 From: JayLuna12 <97865795+JayLuna12@users.noreply.github.com> Date: Fri, 3 Nov 2023 22:58:32 -0700 Subject: [PATCH 2/2] Create screenshots --- screenshots | 1 + 1 file changed, 1 insertion(+) create mode 100644 screenshots diff --git a/screenshots b/screenshots new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/screenshots @@ -0,0 +1 @@ +