I have to rename the filename with some specific keywords changed.
**Input FileName :**
master_1800_20181217120005.csv
master_2300_20181217120005.csv
master_2300_addcarrier_20181217120005.csv
master_2300_XNB_20181217120005.csv
master_2300_XNB_addcarrier_20181217120005.csv
master_850_20181217120005.csv
master_850_addcarrier_20181217120005.csv
master_IBS_20181217120005.csv
master_Smallcell_20181217000500.csv
Output FileName: master_1800_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_2300_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_2300_addcarrier_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_2300_XNB_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_2300_XNB_addcarrier_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_850_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_850_addcarrier_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_IBS_ $(date -d '1 day ago' +%Y%m%d)
120005.csv master_Smallcell_ $(date -d '1 day ago' +%Y%m%d)
000500.csv
I tried using $(rename 's/20181217/20181218/' )
but no luck.
rename 20181217 20181218 master_*.csv
可能会解决问题
This work: rename 's/20181217/20181218/' YOUR_FILE_NAME
Or you can use sed, before you redirect you output to the target file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.