CSE 271: Homework 4

Assigned: 1 March
Due: 5 March

  1. (1 point) Write a regular expression that would allow you to grep for all lines containing words that start with "f" and end with "s".
  2. (1 point) Find a regular expression that will match all lines containing a capital "L", but not as the first character on the line.
  3. (4 points) Write a regular expression (that is supported by emacs) that matches dates in the American MM-DD-YYYY format where months and days can be 1 or 2 digits, years must be 4 digits starting with a 1 or a 2, and the delimiter is either "-" or "/" but not both.
  4. (2 points) Learn (using man pages, books, online references) about sed(1) and how it can find and edit text in files using regular expressions and write a sed command that will output lines of a file that are less than 10 characters in length.
  5. (2 points) Write the sed command to replace all occurrences in a file of "the" with "a" and "The" with "A".

Submission Requirements

  1. As usual, your homework must reside in the cse271.131/hw4 subdirectory.
  2. Do a touch DONE when your homework, in a plain text file called hw4.txt is ready to be collected.

Last revised: 28 February 2013.