This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS2044 HW1 February 21, 2009 CS2044 Homework 1 Due: February 27th, 6pm. Submit solutions to CMS, http://cms.csuglab.cornell.edu . Problem 1: Word Frequencies. Turn in index.sh and update.sh . Problem 2: Interview Question. Turn in interview.sh . Introduction Welcome to CS2044! The goal of this assignment is to get you comfortable with commonly used UNIX tools. After the assignment, you should be familiar with the following concepts. • Input/output redirection. • Use of pipes and pipelining to simplify your scripts. • Use of special characters in the shell. • Regular expressions. • Variables, both shell variables and how to use your own. • Passing arguments to a script, and using them inside the script. Of course, it is not expected that you become an expert on these topics. Rather the purpose is to have you gain enough confidence that you can make use of these tools for the rest of the course, and will know where to look when you are in need of more information. Guidelines It is helpful to write scripts modularly , which means to break the original problem into subproblems and write a separate script for each subproblem. The initial task can then be solved by pipelining the small scripts. Please comment your code. Not only is it helpful for others, but chances are that down the road you may need to rerun your old scripts and your own comments become indescribably valuable. It can make the difference between just tweaking some parameters, and having to tackle and code the whole task again. I suggest using the following header for all your scripts. #!/bin/bash # Created on [date] by [name] # Purpose of script: [description] # Usage: [how to run the script, e.g. script -option <datafile>] Hint: In this assignment, it will be helpful to study the man pages for sort , uniq , wc , sed , tr and grep . 1 CS2044 HW1 February 21, 2009 Problem 1: Word Frequencies What happens when we enter, say “Quixotry”, into a search engine? How can the computers rank the relevance of the contents on the pages of the Internet to this particular query?...
View Full Document
This document was uploaded on 05/21/2009.
- Spring '09