Question

This will require a Linux operating system and regular expressions to complete. You can also use...

This will require a Linux operating system and regular expressions to complete. You can also use https://regexr.com/ to find the appropriate regular expression to use on the text. Using the text from names.txt below, come up with an egrep command in the bash terminal that finds the lines requested.

  1. Using names.txt
    1. Find all entries of people who live in cities whose names are multiple words.
    2. Find all entries of people whose cities (if given) are at least 8 letters long. Make sure you do not just search for sequences of 8 letters as this could also get last names.
    3. Find all entries of people who have middle initials.
    4. Find all entries of people whose zip code has “22” in it. NOTE: this should not include Mike Keneally whose street address includes “22”.
    5. Find all entries of people who have complete addresses (including street number and name, city, state and zip code).

names.txt:

Bianca K. Jones, 612 Charles Blvd, Louisville, KY 40568

Frank Zappa, 101 Hot Rats Blvd, Los Angeles, CA 90125

George Duke, Apt 6, San Diego, CA 93241

Ian I. Underwood, 61 Brown St, Chicago, IL 63112

Mike Keneally, 2242 Sluggo Dr #6, Orange County, CA 90551

Pamela C. Barnes, 12 Caster Ln, Los Angeles, CA 90221

Ruth Underwood, 16161 Mallet St, Mariemont, OH 42522

Suzie Creamcheese, Lark Towne Ave, San Obispo, CA 91100

Terry T. Bozzio, 86 Meadowland Dr, New York, NY 06386

Thana Harris, 1234 Inca Roads, KY

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

please find the linux script below.

$ cat test.sh
#!/bin/bash
IFS=","


while read name add city zipcode
do
#echo "Name is : $f1"
#echo "Address is : $f2"
#echo "City is : $f3"
#echo "zipcode is : $f4"
  
#question 1: Find all entries of people who live in cities whose names are multiple words.
# searching for a space to check if city got two words using regular expressions all through
case "$city" in
*[[:space:]]*)
echo "City $city against name $name got two words" >&2
;;
esac
  
#question 2:Find all entries of people whose cities (if given) are at least 8 letters long. Make sure you do not just search for sequences of 8 letters as this could also get last names.
string=$city
if [ ${#string} -ge 8 ]; then echo "$name got atleast 8 characters" ;
else
echo "city $name doesnt match character length"
fi
  
#question 3:Find all entries of people who have middle initials.
# I'm just searching for a dot in middle name
if [[ $name == *.* ]] ; then
echo "$name got middle name"
fi
  
#question 4:Find all entries of people whose zip code has “22” in it. NOTE: this should not include Mike Keneally whose street address includes “22”.
if [[ $zipcode == *22* ]] ; then
echo "zipcode against name $name got number 22 in it"
fi
  
done < names.txt
according to check guidelines i have solved first 4 questions.

code scrrenshot:

kindly upvote.

output attached

Add a comment
Know the answer?
Add Answer to:
This will require a Linux operating system and regular expressions to complete. You can also use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • CITY Police Officers Non Enrolled/Not Grad Families < Poverty Level Serious Crimes Single Female Parent Households...

    CITY Police Officers Non Enrolled/Not Grad Families < Poverty Level Serious Crimes Single Female Parent Households Male Arrests Drugs (%) Atlanta, GA 1533 3247 21686 76398 36577 69 Birmingham, AL 724 1891 14075 33895 22391 64 Chicago, IL 12132 27838 116645 * 197631 69 Cleveland, OH 1682 5262 31340 45610 45455 64 Dallas, TX 2857 10702 35085 154929 54434 59 Denver, CO 1361 3312 14417 36558 24215 60 Detroit, MI 3954 13455 71673 127080 113553 58 Fort Lauderdale, FL 463...

  • Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there a...

    Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there are no class _descriptions display 'No description is available yet'. (USE NVL) 2 Give a listing of only the lname and the class_code for students who are taking 'Introduction to C programming'. (Inner join) 3 Give a lising of all the class_descriptions and the number...

  • The Language Is SQL The language is SQL 13- List full details of agents with first...

    The Language Is SQL The language is SQL 13- List full details of agents with first names having exactly three or four letters sorted by the state attribute. 14- List the first name, the last name, the address, the city, the state, the branch number, and the email of agents working in the branch 8005 and having email addresses from yahoo.com. 15-List the first name, the last name, the address, the city, the state, the branch number, and the email...

  • Overview This lab provides you the opportunity to insert and update data with the use of SQL comm...

    Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...

  • please read this articel and write one page summary atleast 250 words: MLB managers learn Spanish...

    please read this articel and write one page summary atleast 250 words: MLB managers learn Spanish to unite teams and clubhouses: At spring training of 1962, the newly hired manager of the San Francisco Giants, Alvin Dark, gathered several of his side's Latin American players together behind second base. Once there, he gave an order that left them surprised, stunned and outraged. "He told us that we couldn't speak Spanish to each other in the clubhouse", said Orlando Cepeda, who...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT