Homework #5

Assigned: October 25
Due: November 3, 4:30pm

Problem

(71 points) Write a Korn shell filter script to convert the webpage here to this standard output stream (which is in a format easily imported into a database system).

Requirements

  1. Your script may only invoke the following programs: [eg]rep, sort, uniq, tr, sed, cut, paste, join, awk, or lynx.
  2. Should you desire to use an additional tool or program, consult the instructor first; make no assumptions about permissible tools.
  3. Your script must only write to standard output.
  4. Your script must not write or produce any intermediate files.
  5. Full credit will only be awarded to those submissions which produce the exact same output given above (i.e., zero differences as defined by cmp and diff or sdiff).
  6. Your script must terminate with a proper exit statement (0 for success and non-zero for failure).

Hints

The following command line will write the human-readable contents of a webpage to standard output: lynx -dump -width=200 <URL>. You may rely on the presence of the file urls.txt in the directory from which your script is run. Correct solutions which do not rely on the presence of this file will receive an extra 10 points. You are advised to invest thought into the necessary transformations, and how to structure those transformations, to map the webpage to the final output. If designed properly, the script required to solve this homework should occupy no more than 75 lines of code (and it has been done in as little as 18 lines of code not including the comment header). Aim for correctness, not terseness.

How to submit

Note: All directory and filenames below are case-sensitive. You must use the directory and filenames exactly as shown below (i.e., all lower case).

Prepare your source code file as /home/<logname>/homeworks/hw5/pvsfilter, where <logname> is your login name (e.g., cps444-n1.01). Your source file pvsfilter will be electronically collected from this location in your UNIX account on the deadline.

Failure to follow these submission requirements will result in a 10% penalty.

Evaluation

Ninety percent of your score will come from correctness and 10% of your score will come from following our programming style guide. Applicable submission penalties will then be applied.


Return Home