Piping, Grep, and Redirection

20 points

Piping, Grep, and Redirection

Requirements

Record each of the command used (2 pts each)20
Total20 pts

Resources

Objective

To work with the pipe symbol, the grep command, and redirection

Instructions

Perform each of the tasks described below and record the command(s) used to complete each task in a text file.

  1. Copy the file named `phone_book` from my documents directory. (`/home/singer/docs`)
  2. Use grep and/or cut commands to extract the following information from the phone_book file.
    1. A list of all the data for people who have a 4 in their phone number or zip code.
    2. A list of all of the first and last names only.
    3. A list of all of the phone numbers only.
    4. A list of all of the data for people whose zip code is 86776.
    5. Create a file containing all of the data for people whose zip code starts with 20. Name the file zip20.
    6. Create a file listing for people with a 546 phone prefix. Store only their names in the file alphabetically by last name. (Use piping and redirection.)
    7. Display all of the data for people with last names beginning with M.
    8. Display all of the data for people whose first and last names begin with M.
    9. A list of only the first names