CSC 271-Software I : Utilities and Internals

Dr. R. M. Siegfried

Assignment #8 - Using grep and sed

Due Wednesday, October 11, 2017

  1. Use grep and wc to determine how many times Edgar Allen Poe's poem "The Raven" contains the word "raven". You can find the poem here.
  2. Use grep or egrep to pick out the lines in a text file which satisfy:
    1. Blank lines
    2. Lines with at least 3 characters
    3. Exactly 3 letters from abc
    4. Of the format non-a followed by 3 to 5 a's followed by a non-a
    5. Lines without the punctuation
    6. Lines with an upper case letter
    7. Lines with abc or cba or bdc
  3. Use sed to change a text so that every period at the end of a sentence is changed to an exclamation point (!) and every question mark is replaced with an ellipsis (...).
  4. Change every occurrence of the word forest with woods but only at the end of a line
  5. Use sed to change a document so that every occurrence of a three-letter abbreviation for a month is replaced by the appropriate number, i.e., Jan is replace by 1, Feb by 2 etc.

[Back to the Assignment List]