Question
Create a data file called .addr_book in your home directory. This file is a book of contacts and should contain entries for people, businesses, etc.
Create a data file called ".addr_book" in your home directory. This file is a book of contacts and should contain entries for people, businesses, etc. For example you might have an entry for me: Mike Murphy - Linux Instructor - email: murphymike@fhda.edu Note that each entry is a single line! Have at least 3 entries in the file. (Don't have any blank lines or any comment lines.) Here is another example using generic information: Firstname Lastname - jobtitle - email: lastname.firstname@emailserver.com Start a session log with the script command for your command line work. You can type exit before using interactive utilities, like vi, but remember to restart your session log when you leave vi. Use utilities to search for entries in your .addr_book file and display them. For example, one command could lookup my entry and display it, then another command could lookup your entry and display it. If you don't already have one, create a "bin" directory within your home directory Create an empty file in your bin directory called "lookup" and make it executable with appropriate permissions (so you can view or modify or execute your script). Using vi, edit the file called "lookup" that you created in step 6. You will use positional parameters in this script, so make sure to review chapter 25 in the online textbook for this step. The script should perform the following tasks:
Display a message such as "Searching for" then display the positional parameter(s) provided when the script is executed. Using positional parameters, find the entry in the "$HOME/.addr_book" file that matches the positional parameter(s) provided when the script is executed. Then, display a message such as "All Address Book Entries: " Display all lines from the file in sorted order. The output MUST be sorted. You can sort the entire line, you are not required to sort on any specific part of the line. However, if you would like an extra challenge, try sorting on the last name. The output of the lookup script might look something like this when the positional parameter "Murphy" is used when the script executes (two entries in the file are shown in this example): Searching for Murphy... Mike Murphy - Linux Instructor - email: murphymike@fhda.edu All Address Book Entries: Firstname Lastname - jobtitle - email: lastname.firstname@emailserver.com Mike Murphy - Linux Instructor - email: murphymike@fhda.edu While recording to your session log, run your script at the command line. I do not recommend running the session log while you are in vi.
Step by Step Solution
3.48 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
I have completed your assignment Please check and let me ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
6093609eb1924_23741.pdf
180 KBs PDF File
6093609eb1924_23741.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started