В моем проекте у меня есть файл.
Некоторое содержимое этого файла выглядит следующим образом:
user=bio-zhaoy group=bio-zhaijx queue=gpu start=1551321260 total_execution_slots=12 end=1551370299
user=mse-tangchm group=mse-chengch queue=cal-l start=1551351386 total_execution_slots=96 end=1551372665
user=chem-quanm group=chem-jiangw queue=fat start=1551318056 total_execution_slots=18 end=1551374993
user=cs-likm group=cs-hisao queue=cal-l start=1551341318 total_execution_slots=12 end=1551376362
user=cs-likm group=cs-hisao queue=cal-l start=1551340870 total_execution_slots=12 end=1551379856
user=phy-shizs1 group=phy-shizs1 queue=cal-s start=1551372666 total_execution_slots=96 end=1551380535
user=ose-guoz group=ose-guoz queue=cal-s start=1551380539 total_execution_slots=96 end=1551380546
user=mse-tangchm group=mse-chengch queue=cal-l start=1551351334 total_execution_slots=96 end=1551381367
user=bio-zhaoy group=bio-zhaijx queue=gpu start=1551357949 total_execution_slots=24 end=1551384269
user=mee-xud group=mee-hucz queue=cal-l start=1551184507 total_execution_slots=48 end=1551386704
user=mse-tangchm group=mse-chengch queue=cal-l start=1551351362 total_execution_slots=96 end=1551388501
user=maad-linys group=maad-wanmp queue=cal-l start=1551129996 total_execution_slots=36 end=1551389224
user=maad-linys group=maad-wanmp queue=cal-l start=1551129996 total_execution_slots=36 end=1551389224
user=maad-zhoukc group=maad-wanmp queue=fat start=1551336869 total_execution_slots=144 end=1551391828
user=maad-liuzj group=maad-chensy queue=ser start=1551323808 total_execution_slots=1 end=1551392934
user=maad-liuzj group=maad-chensy queue=ser start=1551323868 total_execution_slots=1 end=1551392989
user=maad-linys group=maad-wanmp queue=cal-l start=1551134144 tot al_execution_slots=36 end=1551393349
user=maad-linys group=maad-wanmp queue=cal-l start=1551134144 total_execution_slots=36 end=1551393354
user=maad-linys group=maad-wanmp queue=cal-l start=1551134144 total_execution_slots=36 end=1551393376
user=phy-shaoxj group=phy-wangkd queue=cal-l start=1551134144 total_execution_slots=120 end=1551393380
user=maad-linys group=maad-wanmp queue=cal-l start=1551134144 total_execution_slots=36 end=1551393385
user=chem-wangyg group=chem-wangyg queue=cal-l start=1551324604 total_execution_slots=48 end=1551394118
user=mee-xud group=mee-z queue=cal-l start=1551254511 total_execution_slots=48 end=1551397837
user=mse-xiaow group=mse-g queue=fat start=1551358601 total_execution_slots=90 end=1551398698
user=phy-liugw group=phyd queue=cal-l start=1551352409 total_execution_slots=360 end=1551400256
user=mee-xud group=mee-huz queue=cal-l start=1551310151 total_execution_slots=48 end=1551400565
user=mse-xiaow group=mse-l queue=fat start=1551400769 total_execution_slots=90 end=1551401158
Теперь я хочу вычислить значение времени для каждой строки.
Метод расчета:
(end-start)*total_execution_slots
Например, с первой строкой:
(1551370299-1551321260)*12
Мне нужно решить в оболочке bash. Я хочу взять рассчитанное значение в качестве
последний столбец.
Я пытался:
for i in $(cat file)
do
starttime=`awk '{print $4}' $i | awk -F '=' '{print $2}'`
endtime=`awk '{print $6}' $i | awk -F '=' '{print $2}'`
slots=`awk '{print $5}' $i | awk -F '=' '{print $2}'`
totaltime=($endtime-$starttime)*$slots
echo $i" "$totaltime >> resultinfo
done
Но зависает, когда я запускаю этот скрипт
кто может мне помочь?