I have multiple files in one directory with below format, so I want to rename all like below:
From
27_07_2017file1vc001vpxd-1605.log
27_07_2017case2vc001vpxd-9169.log
27_07_2017server3vc001vpxd-4640.log
27_07_2017file24vc001vpxd-9170.log
27_07_2017files5vc001vpxd-4641.log
To
file1vc001vpxd-1605_27_07_2017_1.log
case2vc001vpxd-9169_27_07_2017_1.log
server3vc001vpxd-4640_27_07_2017_1.log
file24vc001vpxd-9170_27_07_2017_1.log
files5vc001vp-4641_27_07_2017_1.log
Need to change on format of files from datefilename.log to format filename.date_1.log
Please not to suggest using rename command, since it doesn't work in my linux server.
Thank you
mv 07-2017filename.log filename_31-07-2017_1.log? If you post your script code and a error message we might be able to help you more.renamework? is it not installed? do you only have the primitiverenamefrom util-linux? In either case, install the perlFile::Renameversion ofrename. It can easily do exactly what you want and is the best tool for this job. It's in therenamepackage on debian-like distros, and many others also have their own package ofFile::Renamerenameis the right tool for the job. There is no such thing as "It doesn't work". Maybe you need some help installing it, but that's a different issue._<date>_1, you say.<date>_1in the text of the question, and you say_<date>.1in a comment.