插入字符到在bash字符串? [英] Insert characters Into a string in bash?
本文介绍了插入字符到在bash字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要把字符串125959
到12时59分59秒
。
显然,字符串是时间,所以经常EX pressions都没有太大的好这里。
解决方案
=时间125959
回声$ {时间:0:2} $ {时间:2:2} $ {时间:4:2}
I need to turn the string "125959"
into "12:59:59"
.
Obviously, the string is the time so regular expressions aren't much good here.
解决方案
time=125959
echo ${time:0:2}:${time:2:2}:${time:4:2}
这篇关于插入字符到在bash字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文