shell scrip question

weixin_38087180 2007-12-27 09:34:46

Hi guys,

How can I change the format of number less than 10 to be 2 digits by adding "0" ahead of it?  I mean by shell script.

Say I have a file a.txt with below contents
a-1.7.3
bc.2.3.11
cde_3.12.9.20

How can I get b.txt with contents like below

a-01.07.03              
bc.02.03.11        
cde_03.12.09.20   



The number can be quoted with period ".". dash "-" or underscire "_"
...全文
20 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

476

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧