Tag Archives: awk

homogenization of hours and minutes with awk


~$ awk -F ' ' '{if($3=="hours") {print $2*60, "min" } else {print $2,$3}}' /tmp/sample.data
120 min
20 min
0
20 min
120 min
25 min
5 min
10 min
25 min
45 min
10 min
95 min
80 min
20 min
0
20 min

sample file

data  2 hours
data  20 min
data  0
data  20 min
data  2 hours
data  25 min
data  5 min
data  10 min
data  25 min
data  45 min
data  10 min
data  95 min
data  80 min
data  20 min
data  0
data  20 min