CS476/576
Asignment #1
Due Midnight, Wednesday Sept. 27, 2006
Write a shell script (in any shell you like) with the following descriptions:
NAME
getemails - get emails info.
SYNOPSIS
getemails <file>
DESCRIPTION
The program takes one
argument <file> that contains a set of lines. Each line starts with last
name of a person followed by the first and possibly other given names.
The program uses the <file> and the UNIX password file (PassFile) to produce three files:
<file>-NameEmailList
<file>-EmailList
<file>-NotFoundList
For example:
% getmails InputFile
Produces:
Ø
For a given
person P, search the PassFile for a match of both the first and last name.
If there is exactly one match, insert the
information of P into:
<file>-NameEmailList & <file>-EmailList.
Ø
Otherwise, search for a match
of either the first or
the last name.
If there is at least one match, ask
the user to select the right match.
If the user selects a match,
insert the information of P into:
<file>-NameEmailList & <file>-EmailList.
Ø
If there is no match or the user did not select any mach, then
insert P’s name into:
<file>-NotFoundList.
SEE ALSO
ypcat passed, egrep, awk.