Assignment 3

Due: Wednesday, October 29, 2003 before class

Background

    When Woody Allen directs films, he often does not provide any of the actors with a full script. Instead, each actor only sees the lines for his or her own scene and has no further knowledge about the film (presumably, he does this so that actors only focus on their own character). For this assignment, suppose Woody Allen is directing the Shakespeare play Othello. We will use UNIX tools to generate scripts for actors in the film.

Part I: AWK

Part II: shell

    Write a UNIX shell script that allows us to do what we did in Part I, but more generically for any character name in the play. The script accepts a single argument which is a character name, and changes the AWK script in Part I to print out only the lines for that character. Name the script outputscript. An example invocation is:

    outputscript RODERIGO

    Which should only print out lines for RODERIGO.

    There are a number of different ways you can change the AWK script. It is up to you which commands you'd like to use. Some approaches include (but are not limited to):

    1. Send the AWK script as an argument using the character name as a parameter, carefully using shell quoting rules.
    2. Put the AWK script in a separate file and create a new AWK script with the appropriate character name using sed, and run.
    3. Use shell here documents.

Turning in the assignment