diff --git a/cs205_final_exam.sh b/cs205_final_exam.sh new file mode 100755 index 00000000..512400cf --- /dev/null +++ b/cs205_final_exam.sh @@ -0,0 +1,13 @@ +# TODO: Modify this file to create a shell script that is able to use awk to go through a file formatted like best_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 DATA FILE ===== +# File name: [VALUE] +# Total Pokemon: [VALUE] +# Avg. HP: [VALUE] +# Avg. Attack: [VALUE] +# ===== END SUMMARY ===== + +# The "Avg." values should be calculated as mean values for the corresponding columns. +# 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 best_pokemon.dat. However, you can assume that any file passed to this script will be formatted exactly the way best_pokemon.dat is formatted. +awk 'BEGIN{print "SUMMARY OF DATA FILE"}{print "File name: "}{print FILENAME}{print "Total Pokemon: "}{print "Avg. HP: "}{print "Avg. Attack: "}END {print "END SUMMARY}'