Question: In Bash, you can declare and assign variables for later use. For example i=2 declares a variable named i and assigned 2 to it. You

 In Bash, you can declare and assign variables for later use.

For example i=2 declares a variable named i and assigned 2 to

In Bash, you can declare and assign variables for later use. For example i=2 declares a variable named i and assigned 2 to it. You can use the variable by adding a $ before the variable name. For example echo $i prints the value of the variable i on the screen. Task: Read from stdin a matrix and calculate the sum of the i-th column by a single line of command. The rows of the matrix are separated by a newline character, and the columns of the matrix are separated by spaces. Below is an example of a 33 matrix. You can assume that the user input ends with a newline and then pressing Ctrl+D. Also, assume that the variable i is declared and assigned a valid value beforehand. That is, the value should be an integer between 1 and the number of columns inclusively. Hints: 1. Check the man pages of the commands paste and bc Using the same setting as in Problem 1. Task: Read from stdin a matrix and calculate the sum of the i-th row by a single line of command. Hints: 1. Leading spaces and trailing spaces in a single line, if there is any, can be trimmed by xargs 2. sed is a powerful tool for text editing including search and replace. For example, passing the argument 's/a/b/g' would replace all a in the input into b

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!