Exercises

Exercise 1:

Lets Print All odd numbers from 1 until 100

The solution can be found on the other tab.

Exercise 2:

Print average

input
4
1
2
9
8
output
5.000

The '4' in the first line indicates that there are four integers whose average is to be computed. The average = (1 + 2 + 9 + 8)/4 = 20/4 = 5.000 (correct to three decimal places)

Solution 1: Piping

The solution can be found on the other tab.

Solution 2: if python isn't installed

Exercise 3a: Bash and GREP

Write a program a program that will receive a filename as an input. The user will then be prompted to enter how many lines to show and the string to search for. After so the user will be prompted to enter if he would wish to output the search to a file. The output should be like the following:

Solution:

Exercise 3b: Extended GREP - Part II

Add the following functionality, if the passing argument is "many" the program will prompt how may files to accept. Afterwards the user will enter each file name and the results will be returned. You must use a for loop. Here is an example of our extended GREP

Solution:

Last updated