User Tools

Site Tools


cs_lang:awk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
cs_lang:awk [2012/04/30 09:27] – created cedriccs_lang:awk [2012/04/30 09:28] cedric
Line 23: Line 23:
 </code> </code>
  
 +===== Round time =====
 +<code awk>
 +ligne=""
 +{ for(i=1; i<=NF; i++) {
 + if ($i !~ /^[0-2][0-9]:[0-5][0-9]:[0-5][0-9]$/)
 + ligne=ligne" "$i
 + else
 + {
 + split($i,T,":")
 + T[3]=int((T[3]+5)/10)*10
 + if (T[3]==60)
 + {
 + T[3]="00"
 + T[2]++
 + if (T[2]==60)
 + {
 + T[2]="00"
 + T[1]++
 + }
 + }
 + if (T[3] == 0) T[3] = "00"
 + ligne=ligne" "T[1]":"T[2]":"T[3]
 + }
 +}
 +print ligne
 +}
 +</code>
cs_lang/awk.txt · Last modified: 2012/04/30 09:30 by cedric