UNIX shell 字符串截取实例!!

来源:互联网 发布:三维立体图软件 编辑:程序博客网 时间:2024/06/03 19:41
read DATE
month=$(echo $DATE | awk '{ print substr($1,5,2)}')
year=$(echo $DATE | awk '{ print substr($1,1,4)}')
day=$(echo $DATE | awk '{ print substr($1,7,2)}')
echo $year
echo $month
echo $day
0 0