Reputation: 11
I work with Debian. I have to split a 75 GB into 1000 pieces of 75 MB. I renamed them badly starting at piece 90, and I have to solve that problem.
File section file_89
was OK. But it followed with file_9000
instead of the file_90
. And from there numbering followed file_9001
, file_9002
, ...
Total that I have to rename from the file_9000
to the end and pass the names to file_90
to the end, but without losing the order they have.
I'm trying to do it with the rename command, but I can not find a viable solution.
Thank you
Upvotes: 0
Views: 69
Reputation: 5372
Since you didn't inform the complete range of files, let's assume you are going to rename from 9000 to 90, 9001 t0 91 and so forth until 9100. The difference we have to remove from each number is 9000 - 90 = 8910, so something like this will do the job:
for n in {9000..9100}; do
mv file_${n} file_$((n - 8910))
done
I guess you can took from there and adapt the example to your case. I hope it helps.
Upvotes: 1