Using shell scripts and sed commands to edit a text file

timer Asked: Oct 22nd, 2018

Question Description

1. In Linux, using sed, make the following changes in the file named ConscientiousSoftware0.txt and save the result as a new file named ConscientiousSoftware1.txt.

  1. Delete trailing white space in each line.
  2. Make sure that every comma is followed by exactly one space.
  3. Make sure that every period is followed by exactly two spaces. Bonus points given if you make an exception for the period appearing at the end of a line, with nothing more on that line.
  4. Make the above into a script procedure called modtext()

2. In Linux, using sed, edit the file firstMonday.html as follows:

  1. Insert newlines appropriately to make sure that no line is longer than 70 characters.
  2. Remove empty/blank paragraphs, if any. (HTML paragraph starting tag is <p> and ending tag is </p> <p>This is some text in a paragraph.</p>
    We can say that a paragraph is empty if there is nothing or has only spaces or tabs in between <p> and </p>)
  3. Remove all images ( HTML, images are defined with the <img> tag. example: <imgsrc="html5.gif" alt="The official HTML5 Icon"> <img alt=""> )
  4. Make the above into a script procedure called rmHTML()

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors