I need help to modify my Shell script!!

April 30, 2011 at 16:23:24
Specs: Windows Vista

Surname, Forename: Day.Month.Year : Degree
Smith, John: 15.01.1986: MSc IT

I need some help to write a shell script which uses
(awk) to read in the data file students.txt and assign the dates of birth into an array indexed by surname. Your script should then prompt the user to enter a surname, whereupon it should return the corresponding date of birth for that student.

An example of how your output would look is shown below:

$ Please type a student surname:
$ Smith
$ Date of birth: 15.01.1986

Help me to make this code run..!

echo "enter the surname"
read surname
birthdate=`grep $surname students.txt | awk -F[: ] '{print $3}'`
echo "Date of birth: $birthdate"


See More: I need help to modify my Shell script!!

Report •

May 10, 2011 at 03:00:15
Obviously a homework assignment. I got a job in the computer field by doing my own homework. Nobody on the job is going to do your work for you so you might as well get used to doing it yourself.

Report •
Related Solutions

Ask Question