Chinaunix

标题: 简单的shell问题?? [打印本页]

作者: nft    时间: 2007-05-16 21:08
标题: 简单的shell问题??
我程序输出的格式2007-05-16.2047(2047为时间),如何把格式改成2007-05-16 20:47,大家帮我看看如何用sed,awk写谢谢!!!

[ 本帖最后由 nft 于 2007-5-16 21:35 编辑 ]
作者: ddie    时间: 2007-05-16 21:35
echo "2007-05-16.2047" |sed 's/\.\(..\)\(..\)/ \1:\2/'
作者: nft    时间: 2007-05-16 21:36
非常感谢!!
作者: wdavid    时间: 2007-05-16 21:45
sed  -e  's/\./ /'  -e  's/\(..\)\(..\)$/\1:\2/'
作者: __lxmxn__    时间: 2007-05-16 21:55
Study




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2