码迷,mamicode.com
首页 > 其他好文 > 详细

awk中split函数的用法

时间:2016-02-18 19:46:31      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

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]}‘

 

awk中split函数的用法

标签:

原文地址:http://www.cnblogs.com/fjping0606/p/5198854.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!