ASSIGNMENT 1 | UNIX SHELL SCRIPTING HARD DEADLINE Solution

$30.00

Description

1. Finding the maximum and minimum of N integers

Generate N random integers in the range [0, 107] and save them to a file

Now create P processes such that each process will work on only N/P of the integers from the file (each integer can be processed by one process only)

Once each process completes execution, it will return the maximum and minimum integers from among the numbers allocated to it to a combiner process

Now this combiner processes will compute the maximum and minimum integers from among all the local maximum and minimum integers.

(a) Use the given values of N (N=103, 104, 105, 106) while keeping P constant at 5. Time how long it takes for your script to run for each run. [ 5 points ]

(b) Now increase the number of processes P (P=5, 10, 25, 50, 100) while keeping the value of N constant at 105. Time how long it takes for your script to run for each run.

[ 5 points ]

SUBMISSION GUIDELINES

1) Submit a log file that contains the time for all runs. Name of Run: Constant P or Constant N (Value of P or N) Value of N or P:

Time Taken:

Filename Format: Q1_TimeLog.txt

2) Submit your script for each case

Filename Format: Q1a & Q1b (No file-extension)

2. Implement the “Replace all” feature that you find in MS-Word using the sed command

(a) Given an input file, replace every occurrence of the keyword “apple” in your input file to “orange”. [ 5 points ]

(b) On the same input file, replace every third occurrence of the keyword “apple” by

lemon”. [ 5 points ]

SUBMISSION GUIDELINES

1) Submit your script for each case

Filename Format: Q2a & Q2b (No file-extension)

3. Find the frequency of occurrence of specific keywords in a file. The keywords will be provided as input in a file. [ 5 points ]

SUBMISSION GUIDELINES

1) Submit your script

Filename Format: Q3 (No file-extension)

4. Printing specific lines from a file [ 5 points ]

(a) Print every third line of an input file

(b) Now print every third line of the given input file only if it has the string “ABC”

(c) Now print every third line of the input file only the line has an even number of words

SUBMISSION GUIDELINES

1) Submit your scripts

Filename Format: Q4a, Q4b, Q4c (No file-extension)

5. Using regular expressions, check if an input email address is in a valid format [ 10 points]

This should recognize any valid format. Think about Ashoka E-Mail IDs. It should work for any kind of ID.

Some examples of valid formats:

@ .

. @ .

. @ . .

SUBMISSION GUIDELINES

1) Submit your script

Filename Format: Q5 (No file-extension)

Overall Submission Guidelines

1. Make a .zip file of all your files (follow the naming convention specified) Filename: GroupNumber.zip

2. Submit this zip file on Google Classroom only

3. Don’t try to invoke any high level programming language. This should be done entirely using unix shell commands.