I have a repertory where some of the files have to be renamed :
alabama.txt california1.txt california2.txt california3.txt florida.txt
The californiaX.txt
files should be renamed cX.txt
, X
being a number.
Here is what I tried :
ls | sed 's/california/c/'
but this cannot store the results. Reading some other posts, I tried adding sh
but it says "command not found".
ls | sed 's/california/c/' | sh
The rename
command doesn't work either (I'm on Mac).
The mv
command works only for a file. So I tried a loop, which, same, doesn't work :
for file in california*; do mv file c*; done
Any info on what I'm doing wrong would be welcome.