我有以下格式的文件:
2017-05-01-1500-00S.SRO___001_BH_Z
2017-05-01-1543-04S.SRO___001_BH_E
2017-05-01-1543-04S.SRO___001_BH_N
2017-05-01-1543-04S.SRO___001_BH_Z
2017-05-01-1600-00S.MOG___001_SP_E
2017-05-01-1600-00S.MOG___001_SP_N
2017-05-01-1600-00S.MOG___001_SP_Z
2017-05-01-1600-00S.MYA___001_SP_E
2017-05-01-1600-00S.MYA___001_SP_N
2017-05-01-1600-00S.MYA___001_SP_Z
2017-05-01-1600-00S.SRO___001_BH_E
2017-05-01-1600-00S.SRO___001_BH_N
2017-05-01-1600-00S.SRO___001_BH_Z
我制作了一个 bash 脚本,其中列出了一些变量:
st =ls -1 2* | awk -F "[.__]" '{print $2}' | sort | uniq
cmp =ls -1 2* | awk -F "[__]" '{print $5$6}' |sort | uniq
天=ls -1 2* | awk -F "-" '{print $3}' | sort | uniq
我想制作一些具有以下格式的文件夹:
st
// cmp
_day
然后将对应的值复制到其文件夹中。
例如文件如下所列:
2017-05-01-1500-00S.SRO___001_BH_Z
2017-05-01-1543-04S.SRO___001_BH_E
2017-05-01-1543-04S.SRO___001_BH_N
2017-05-01-1543-04S.SRO___001_BH_Z
st=SRO
, cmp=BHZ
, cmp=BHE
, cmp=BHN
, 和day=01
所以我需要创建以下目录:
首先: SRO/BHE/01
第二: SRO/BHN/01
第三: SRO/BHZ/01
然后将包含SRO、BHE、01(即day
值)的文件复制到其对应目录。
我希望,我已经提到了细节。
非常感谢。