I have a folder with several files :
1-1.csv
1-2.csv
2-1.csv
And I want to rename them this way :
1-1-hist.csv
1-2-hist.csv
2-1-hist.csv
Following this post I tried the following :
for file in *.csv
do
mv "$file" "${file/.csv/-hist.csv}"
done
But file names don't change and my terminal says :
mv: '1-1.csv' and '1-1.csv' are the same file
mv: '1-2.csv' and '1-2.csv' are the same file
mv: '2-1.csv' and '2-1.csv' are the same file
What am I doing wrong ?
EDIT :
rename 's/.csv/-hist.csv/' *.csv
did the job. Even if I don't know what did not work in the first attempt...