标签:
time=‘12:34:56‘
echo $time | awk ‘{split($0,a,":" ); print a[1]}‘
12
echo $time | awk ‘{split($0,a,":" ); print a[3]}‘
56
time=‘12 34 56‘
echo $time | awk ‘{split($0,a," " ); print a[1], a[2], a[3]}‘
echo $time | awk ‘{split($0,a," " ); for (i=1; i<=3; i++) print a[i]}‘
标签:
原文地址:http://www.cnblogs.com/fjping0606/p/5198854.html