如何以所需格式进行文件名操作

时间:2019-05-08 05:28:02

标签: shell unix aix

我对Unix完全是新手。有人可以帮助我解决目录中包含文件列表的问题,     我想按如下所述以所需格式处理文件名

< Filenames present in directory >
AAAL_555A_ORANGE_F190404_D190408.TXT.freshfruits_20190422-115617    
AAAL_555A_MANGO_F190404_D190408.TXT.freshfruits_20190422-120939    
AAAL_555B_APPLE_F190404_D190408.TXT.freshfruits_20190422-121449    
AAAL_555B_ORANGE_F190404_D190408.TXT.freshfruits_20190422-115617    
AAAL_555B_Orange_F190404_D190408.TXT.freshfruits_20180422-115617    

<After modification  >
If 2nd string 555A and 3rd string is  ORANGE  or  2nd string 555A and 3rd string is  Orange the filename should be BB_Orange_555a_date +'%Y%m%d'.txt    
If 2nd string 555B and 3rd string is  ORANGE  or  2nd string 555A and 3rd string is  Orange the filename should be BB_Orange_555b_date +'%Y%m%d'.txt    
If 2nd string 555B and 3rd string is  APPLE  or  2nd string 555A and 3rd string is  Apple the filename should be BB_Apple_555b_date +'%Y%m%d'.txt     
If 2nd string 555A and 3rd string is  MANGO  or  2nd string 555A and 3rd string is  Mango the filename should be BB_Mango_555a_date +'%Y%m%d'.txt    

有人可以用Shell脚本帮助我吗

0 个答案:

没有答案