Answered step by step
Verified Expert Solution
Question
1 Approved Answer
begin{tabular}{|l|} hline #hid pid age gender 126774360405498148222 126774361405498149291 126774362405498150322 126774363405498152482 126774363405498151492 hline end{tabular} Figure 1. Example of the input
\begin{tabular}{|l|} \hline \#hid pid age gender \\ 126774360405498148222 \\ 126774361405498149291 \\ 126774362405498150322 \\ 126774363405498152482 \\ 126774363405498151492 \\ \hline \end{tabular} Figure 1. Example of the input file (i.e., test.txt) For test.txt, - The file (i.e., test.txt) contains household id, person id, age, and gender for each person. - For gender, 1 and 2 represent male and female, respectively. - If persons have the same household id, they live together. For example, person ids 405498152 and 405498151 have the same household id 126774363 in Figure 1. Design a shell program (Its file name MUST be "person_female_30_50.sh") meeting the following requirements. (1) Read test.txt using a file descriptor (Use exec 3$2 ) - 1 point (4) Print the total number of the extracted person ids.(Use echo) - 2 points (5) Print the total number of the household ids having more than and equal to two extracted person ids. (Use echo) - 5 points For execution, ./person_female_30_50.sh test.txt person.txt test.txt is an input file, and as an output file, person.txt contains 405498152405498152405498151 person_female_30_50.sh will return 3 and 1. 3 indicates the number of the extracted person id. 1 indicates the number of the household id. Submit person_female_30_50.sh and a screenshot showing its result
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