Press "Enter" to skip to content

月份去掉0

[root@iz2zecibr4bozfdvtbnvfkz test]# date -d '1 day ago' +%m
04
[root@iz2zecibr4bozfdvtbnvfkz test]# date -d '1 day ago' +%m|sed -r 's/0+([1-9])/\1/g'
4
[root@iz2zecibr4bozfdvtbnvfkz test]# date -d '1 day ago' +%m|sed s'/^0//'
4

Be First to Comment

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注