Due: Thursday, October 9, 2003 11 PM
In this assignment, in addition to the commands covered in
the previous homework, we work with the commands grep and sed.
Part I: The dictionary
The answers to these questions require using the commands grep or egrep, in some cases wc, and the dictionary file (/home/unixtool/data/words).
The dictionary is case sensitive; keep this in mind when writing
your grep commands. Also, for the purposes of these
questions, y is not a vowel, and a consonant
is any character that is not a vowel (including punctuation).
Count the number of words in the dictionary with two vowels next to each other.
Output all the words in the dictionary that have six consonants (non-vowels) in a row.
Count the number of words in the dictionary with the same vowel two (or more) characters in a row (e.g. foot)
Count the number of five letter words in the dictionary.
Count the number of five letter words that do not contain an e.
Output all five letter words that are a palindrome (the same forwards and backward)
Part II: More Weather
Instead of using the individual weather files, you can use
the output from Question 10 from Assignment 1,
which I have placed in the directory /home/unixtool/data/weather
as the all.daily.
Show days and temperature where the Max temperature is 95 or greater.
Count the number of days where the Max temperature was 70 or greater and the
Min tempature was below 50.
Count the number of days where the Max temperature was 70 or greater, or
the Min temperature was below 50.
Show which days had rain (note that if the field is 0.00 in or -, there is no rain recorded).
Part III: Shakespeare
The file /home/unixtool/data/othello.html contains the Shakespeare
Write sed commands for the following. For each, input is the original
file and output is standard out.
Remove the HTML tags (tags are the text between the < character
and the > character). For this file, it's OK to assume tags don't
span multiple lines.
Make the following changes to the play in a single sed invocation:
Change the character named Iago to Hugo.
Change the character named Othello to Odin.
Remove blank lines
Add the text <hr> before each scene.
Put these commands in a separate file to be used with sed.
Turning in the assignment
There should be four files turned in:
Before each command, put a line of comment
saying which question number you are answering.
Assume that the script will be run from any directory.
- Single shell script for Part I
- Single shell script for Part II
- Single shell script for Part III
- Sed commands for Part III, Question 2
When you have finished, submit using the homework submission system.