Lab 3 week 3

sh (replace “yourlastname” with your actual last name).
Background
Congratulations! You’ve just been hired as the Computer Person by a non-profit charitable organization.
Your new boss, Ms. Lee Nix, has just called you to discuss the organization’s fundraising goals for the
coming year. Ms. Nix would like to send a “Thank You” email to all individuals who have donated to the
organization in the past, in the hopes that this will also serve as a gentle reminder to consider making
another donation. Because not all donors provided an email address, Ms. Nix has also just acquired
software that generates automated phone calls when given a list of phone numbers as input.
Unfortunately, the three individuals whose responsibility it has been to keep track of donor contact
information all used vastly different formats to do so. Making things even more difficult is the fact that
none of these formats was internally consistent. There are millions of lines of text involved, and
extracting the necessary information by hand is out of the question.
Goal
Lee Nix requests that you utilize your Computer Person skills to extract all of the valid email addresses
and telephone numbers from the combined plain-text file containing all of the donor contact
information which was tracked by the three different individuals. The input file contains several million
lines of text (not every line has contact information on it). To make program development and testing
easier, you’ve extracted a small subset containing examples of various formats (input.txt).
Ms. Nix would like for you to get this done as quickly as possible, even offering her lucky red hat as an
additional incentive to work quickly. It occurs to you that a shell script using egrep and regular
expressions is the perfect solution for this problem.
Script Requirements
1) You decided to start the file name with your last name, followed by an underscore, and then
“lab3.sh” (for some odd reason).
2) Input arguments will be either -e filename or -p filename. -e will cause the script to print out the
email addresses. -p will print out phone numbers.
3) You definitely aren’t going to need entire lines to be printed, just the email addresses or the
phone numbers, so you decide to use the -o argument together with egrep to extract needed
information from the file.
4) Ms. Nix told you that she’s certain that phone numbers will have one of these two forms:
ddd-ddd-dddd or (ddd)ddd-dddd.
The following page contains your notes regarding what results the script should produce when applied
to the file input.txt