LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rename command or PERL perlexpr? (https://www.linuxquestions.org/questions/linux-software-2/rename-command-or-perl-perlexpr-356541/)

malaka56 08-24-2005 12:07 PM

rename command or PERL perlexpr?
 
hi everyone.
this is a simple problem, but im having a hell of a time doing it, so i thought i would ask.

HOW DO I USE THE RENAME COMMAND? (red hat version)

its really confusing, especially for someone not familiar with perl.

basically i have filenames "#001" up to "#184" or so.
i just need to add a ".tif" extension on all of them so they like "#001.tif" up to "#184.tif". simple enough, right? i can't seem to figure out how to use the rename command, and this task is apparently too difficult for mv. any help would be appreciated. thanks.

PS.
ive tried all the things that make sense like \#??? \#???.tif \#???

and whatnot. this seems to be a difficult problem.

dub.wav 08-24-2005 12:34 PM

I don't know the rename command, but a simple shell loop will suffice:
Code:

for file in '#'*; do mv "$file" "$file.tif"; done


All times are GMT -5. The time now is 11:45 PM.