Im starting with shell script programming in linux and i need help to solve the following problem:
I need to read from a file.txt the following information
lastName,Name |age | gender | antiquity | profession | response time
Homes,Louis 34 male 12 leader 4
House,Jonathan 26 male 4 designer 7
Smith,Peter 36 male 10 architect 8
Prat,Zoe 40 female 14 programmer 2
Evans,Bethany 30 female 8 programmer 12
with the information I need:
- Profession of the two oldest professionals.
- Average time of the two professionals who have less response time
- Age and gender of the older professional.
Tried with the following code, but it does not work:
#!/bin/bash
while read line
do
antigüedad=$(echo $line|cut -d" " -f4)
if [[$antiquity -gt $greaterAge]]
then
greaterAge=$antiquity
moreOld=$line
fi
done < data.txt
How could I solve this?