Question: This first lab question is to write a simple shell script. First, though, write the command pipeline to - find some accounts in the password
This first lab question is to write a simple shell script. First, though, write the command pipeline to - find some accounts in the password file (with grep), AND - cut out the names in the fifth field of those accounts, AND - list them in alphabetical order on the second name in that field (it may be a users first name or their last name or their middle initial.) These are all in a single pipeline. But now you want to both DISPLAY that list of people, AND ALSO put a total of how many are in the list at the bottom. You need to figure out how to do all that, and then put the instructions into an executable file. You will now have a shell script, namely the file with that pipeline. Summary: Put the commands into a file that will: get the accounts from /etc/passwd where the persons real name (not the account name) starts with any of the letters A-G. (Look at the full names and just the first letter of the first name in the field.) cut the full names sort on the second name (it may be a middle initial) and put the results in stdout, with a total of the number of people at the bottom (If the name is in the form: Last-name, First-name Possible middle initial-or-name, you would make sure the Last-name starts with A-G, but sort on the First-name, after the comma. If there is no comma, you can choose so the very first letter of the first name in the field starts with A-G, and whatever name is second in the field (it may be a middle initial or a last name) is used for the sorting.) Make the command file executable, and put it in my home directory
Write a command that will add a name, phone number, and email address (you can make them up) to the file phones.txt. Then write a separate command that will list the phone.txt file on your terminal in order by last names, and with the fields separated by multiple spaces or tab characters. For this lab, make the commands to list the phones.txt file into a shell script, that anybody can execute, that will list the current phones.txt to standard out sorted and nicely readable (by a human).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
