Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

DSCC 201/401 Homework Assignment #3

Due: February 14, 2024 at 9 a.m. EST

Answers to these questions should be submitted via Blackboard. Please upload a file containing your answers and explanations to Blackboard (Homework #3: Linux Environment) as a Word document (docx), text file (txt), or PDF. All input and output should be plain text (cut and paste from a terminal window) consolidated into one file, with your name provided at the top. It is very important to include the command you used to give the answer to the question. Credit will only be given if the command to answer the question and the output have been provided.

For each of the following questions 1-7 provide the input command and the output generated.

1.   Download the file NSF_Awards.tar.gz from Blackboard. Upload the file to your

home directory on BlueHive. What is the total amount of disk space used by the NSF_Awards.tar.gz file that you copied to BlueHive? Show the command how you determined the size of the file. (Note: Some operating systems may automatically decompress the file. Please make sure to save the file directly without automatically decompressing it.)

2.   Read the manual pages for the gunzip and tar commands. Uncompress the

NSF_Awards.tar.gz file with the gunzip command and then subsequently unarchive the NSF_Awards.tar file. Show the command you used to uncompress and unarchive the file.

3.   What is the combined total size of all files (amount of storage on disk) in megabytes

located in the NSF_Awards directory? Show the command you used to calculate this value.

4.   How many txt files are located in the awards_1991/awd_1991_09 directory? Show the command you used to calculate this value.

5.   Using the find command, what is the name of the single largest text file (txt) located in the awards_1990 directory and all of its subdirectories? What is the size of this file? Show the commands you used to determine the answer.

6.   How many lines contain the string IBM in all files in the awards_1991 directory and all of its subdirectories? Show the command you used to calculate this value.

7.   How many lines contain the word "rochester" with any combination of upper and lower case letters in all files in the NSF_Awards directory and all of its subdirectories? Show  the commands you used to determine the answer.

For questions 8, 9, and 10, create three separate files for each of the three Bash script shown below. Run the scripts on BlueHive, examine the outputs, and answer the following questions:

#!/bin/bash

# script 1

pi=3.14159

two_pi=2*$pi

echo $two_pi

#!/bin/bash

# script 2

pi=3.14159

two_pi=$((2*pi))

echo $two_pi

#!/bin/bash

# script 3

pi=3

two_pi=$((2*pi))

echo $two_pi

8.   Show the outputs of script 1, script 2, and script 3.

9.   What is the purpose of the $ in the Bash scripts?

10. What is the purpose of the double parentheses (( )) in the scripts?

For questions 11 and 12, provide the complete source code for a Bash script to accomplish the task as indicated:

11. Write a Bash script that finds all HTML ( .html) files in all directories in the

NSF_Awards directory and replaces the  .html extension to  .htm. For example, link.html will be replaced by link.htm.

12. (DSCC 401 Only) Write a Bash script that concatenates all text ( .txt) documents in the awards_1990 directory into one single text file called awards_1990.txt and all ( .txt) documents in the awards_1991 directory into one single file called awards_1991.txt. Hint: Use the append operator (>>).