Issue
I'm trying to strip the numbers and -
from the file name.
ui-service-3.100.503505.json
kibana-store-end-3.103.103505.json
api-application-3.4003.10350665.json
find . -type f -iname "*.json" -exec rename 's/[0-9]//g' {} \;
throws find: ‘rename’: No such file or directory
Tried multiple other combinations but same error.
I'm expecting below output, where am I going wrong ?
ui-service.json
kibana-store-end.json
api-application.json
Solution
Probably you don't have rename
command on your system. Try this instead:
for file in ./*.json; do
echo mv "$file" "${file%-*}.json"
done
Drop the echo
if the output looks fine.
Answered By - M. Nejat Aydin Answer Checked By - Terry (WPSolving Volunteer)