首頁 >php教程 >php手册 >linux awk时间计算脚本,linuxawk计算脚本

linux awk时间计算脚本,linuxawk计算脚本

WBOY
WBOY原創
2016-06-13 08:51:161339瀏覽

linux awk时间计算脚本,linuxawk计算脚本

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

用awk脚本如下

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

Email:362299908@qq.com

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn