Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UNIX Shell Programming For this exercise you need to manipulate your personal contacts file to find out people whose birthday is today. Hint: consider using

UNIX Shell Programming

For this exercise you need to manipulate your personal contacts file to find out people whose birthday is today. Hint: consider using grep, sort

You are required to write a script titled searchcontacts.sh that will do the following:

  1. The script is going to take as parameters the user's full name: first name, last name.
  2. Greet the user by his or her first name.
  3. Tell the user the day of the week, and the current time in nonmilitary time. The output should resemble the following (See man pages for the time/date commands):

Today is Tuesday and the current time is 04:07:38 PM.

  1. Show the contacts whose birthday is today (hint: look at man pages for date options, then use pipes and grep):

These contacts are having a birthday today:

Xxx .

  1. Ask the user for a friends last name (you may add this as a menu option)

Enter a contact last name to search in file:

  1. Search in the file mycontacts.txt (format is shown below) for that last name and print out to the screen the line with the information about that person
  2. If not found,
    1. Count the number of lines and tell the user that in the screen
    2. Sort the file (by name) and print out to the Console the contents of the mycontacts.txt file (hint: remember commands for sorting)
  3. Tell the user (use first name) good-bye and the current hour. Exit the script.

Mycontacts.txt format:

The information is in one line and separated by spaces,

1. friend's full name: first, last.

2. his/her birth date (dd-mm)

3. his/her phone number (xxx-yyy-yyyy)

4. his/her email (name@domain.xyz)

e.g. John Smith 02-05 213-662-3577 smith@example.com

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

Students also viewed these Databases questions

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago