At my client site, we needed to copy some files from production to test environment rerun. Our custom Oracle Concurrent program renames the file after processing and adds time stamp. For example, XXX_ABC.DAT would become XXX_ABC.DAT_20120629142022 assuming file was processed on 29th June 2012 at 2:20:22 PM. In order to reprocess files in test environment, I needed to replace time stamp. so i searched for Linux command that can strip file suffix. I found this helpful link. The following command described in the link
for x in *;do mv $x $(echo ${x%*.*});done
did not work. But following command worked
for x in *INVOICE* ;do mv $x `echo ${x%*.*}`.DAT; done
if you want to see how suffix is being removed, you may use following command
for x in *;do echo ${x%*.*}; done
Note: i do not know what is being done by "${x%*.*}"
Friday, June 29, 2012
Removing File Suffix
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment