[SOLVED] CS213 Assignment 9 -Sed

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-9-h07apd.zip (68.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)
  1. script1.sh:
    Write a sed command/script to emulate wc -l command. This file is run as a bash script by typing : . script1.sh filename.txt
  2. script2.sed
    Write a sed script which takes an input file and puts a line number at the beginning of each line.

    This file is run as a bash script by typing : . script2.sh filename.txt For example :input.txt has the following contents:

    this is first line

    this is third line this is fourth line.

    1

should be written to output.txt as follows: See that all blank lines also get a number.
(1) this is first line

(2)
(3) this is third line

(4)

this is fourth line

3. script3.sed:
Given input files contains new-lines and white spaces and tabs. Write a sed script to

  1. (a)  Remove all leading spaces
  2. (b)  Collapse every sequence of white spaces between two words in a single line into a single space, and
  3. (c)  Collapse every sequence of white spaces between two lines into a single newline. All other suffix and prefix whitespaces are to be deleted.
  4. (d)  Print the output to screen. For example

” how are you

fine.

becomes

” how are you fine.

4. script4.sed :
There is a text file called input.txt such that there are four “strings” on each line.

For example:

VeenaDaniel Raj 3456 Veena Michael Raj3456

2

This has to be written so that all four fields in the record (line) are sepa- rated by a single tab. Therefore above output looks like

V eena Daniel Raj 4356 V eena M ichael Raj 3465

  • Assignment-9-h07apd.zip