Question: Please answer question 2 regarding shell scripting. Including preceding code for context. Thank you! #!/bin/bash # Bash script to calculates the MAX, MIN, MEDIAN and

Please answer question 2 regarding shell scripting. Including preceding code for context. Thank you!

#!/bin/bash

# Bash script to calculates the MAX, MIN, MEDIAN and MEAN of the word frequencies in the

# file the https://www.gutenberg.org/files/58785/58785-0.txt

if [ $# -ne 1 ]

then

echo "Please provide a txt file url"

echo "usage ./calculate_basic_stats.sh url"

#exit with error

exit 1

fi

echo "############### Statistics for file ############### "

# Q1(.5 point) write positional parameter after echo to print its value. It is the file url used by curl command.

echo $1

# sort based on multiple columns

#Q2(2= 1+1 for right sorting of each columns). Write last sort command options so that first column(frequencies) is

#sorted via numerical values and

#second column is sorted by reverse alphabetical order

sorted_words=`curl -s $1|tr [A-Z] [a-z]|grep -oE "\w+"|sort|uniq -c|sort `

total_uniq_words=`echo "$sorted_words"|wc -l`

echo "Total number of words = $total_uniq_words"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!