PDF Version Available

This document is also available in PDF format: sedlab.pdf

The PDF version includes bookmarks for easy navigation and is optimized for printing.

Accessibility Notice

This document is also available in HTML format at:

https://aholdengouveia.name/LinuxAdmin/labexcercises/sedlab.html

The HTML version provides enhanced accessibility features including keyboard navigation, screen reader support, responsive design, dark mode support, and high contrast options.

Objectives:

Complete the following problems

References, a video and some notes are available at my website

https://www.aholdengouveia.name/LinuxAdmin/Sed.html

Please include the command, a screenshot showing it works as intended, cite all sources you used, and give a short explanation of how the command works and why.

  1. Change the name Jo to Josephine
  2. Delete the last 5 lines.
  3. Print lines 3-15.
  4. Delete lines for people who live in California
  5. Print all lines where the birthdays are in the first week of the month. Be careful of the dates for birthdays, the format is MM/DD/YY
  6. Append three asterisks (*) to the end of lines starting with Sir
  7. Replace the line containing "Westley Pirate" with the phrase "As you wish." Make sure you replace the whole line not just the name
  8. Change Minerva McGonagall's birthday to 10/04/1935. Assume you don't know Minerva's original birthday. Use a regular expression to search for it.
  9. Delete all blank lines.
  10. Write a sed script that will (actual sed script, NOT just the commands on the command line) enumerate
  11. Insert above the first line the title - Great Literary Characters -.
  12. Print the contents of the file, but instead of the phone number starting with an area code, have it start with a 1+, then include the area code and number. For example, (603)123-1234 would turn into 1+(603)123-1234
  13. Append at the end of the file "Happily Ever after. The End"

Deliverables

A text document with the grep statements used to get each result. Clearly labeled so I can see which answer goes to which question.

Please include the command, a screenshot that includes the command and a few results showing it works as intended, cite all sources you used, and give a short explanation of how the command works and why. Make sure everything is in your own words. Think of the explanation as you trying to walk someone through how to use sed when they haven't heard of it before.