Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Bash script where: The script should first read a file line by line, where each line is a person's information formatted as FirstName
Write a Bash script where:
The script should first read a file line by line, where each line is a person's information
formatted as "FirstName LastName, YYYYMMDD City, Country".
The script should filter the lines to only include people who are from a city that
contains two or more words eg "San Francisco" Use a regular expression to check
this.
For each of the filtered lines, the script should extract the person's age in years, based
on the date of birth. You'll need to use a regular expression to extract the date of birth and
then calculate the age.
After all ages are calculated, sort the people by their ages in descending order and print
each person's name along with their age.
Note: You can assume that the current year is for age calculations.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started