Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Distinguish between filtering and interpreting. (Objective 2)

Answered: 1 week ago