·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> linuxawk时间计算脚本

linuxawk时间计算脚本

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23

在linux如果计划时间是个麻烦事,

用awk脚本如下

BEGIN {FS=":";OFS=":"}
 {total_seconds=total_seconds+$3}
 total_seconds>=60 {total_seconds=total_sconds-60
   $2=$2+1
  }
{total_minutes=total_minutes+$2
  $2=$2+1
  }
{total_minutes=total_minutes+$2}
 total_minutes>=60{total_minutes=total_minutes-60
 $1=$1+1}
{total_hours=total_hours+$1}
END{PRint $1,$2,$3}

Email:[email protected]