I am writing a shell script to bulk renamed file.
I have thousand thousand csv file like tis
db_dd.ok.csv
kk_dl.rk.csv
mk_kal.csv
and i am trying to rename all these files and the final file name will be these:
dd.ok.csv
dl.rk.csv
kal.csv
and this is my shell script:
#!/bin/bash
for x in *.csv
do
echo $x | grep '([a-zA-Z]+\.csv)'
done
My regex working good but i can't run here mv
command with the value of grep
, so i tried to put grep value in a variable then i will run mv
command, i failed.
can anyone help me how can I do this?