2
即時通訊開始在Linux中的shell腳本編程,我需要幫助解決以下問題:與shell腳本數據管理
我需要從file.txt的以下信息讀取
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
與我需要的信息:
- 專業的兩個最老的專業人士。
- 兩位專業人員平均時間較短,反應時間較短
- 年齡和性別較老的專業人員。
試着用下面的代碼,但它不工作:
#!/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
我怎麼能解決這個問題?