?
Solved

Rename large number of files

Posted on 2006-06-23
3
Medium Priority
?
284 Views
Last Modified: 2010-04-21
I need some help with a script to run on Solaris 10.  
I have approximetly 1000 files that are named myIMG.bmp.1 all the way to myIMG.bmp.1006.

I need to rename them all.

What I would like is someone to be able to rename for example myIMG.bmp.1 to 1.bmp.  

IMPORTANT
Also there are other files in the directory I don't want to rename any that do not end in a number.  
0
Comment
Question by:devildog1775
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 2000 total points
ID: 16973036

This will generate a script that will do it for you:

 ls myIMG.bmp.*|awk '{print "mv " $1 " " $1}'|sed 's/myIMG.bmp.//2;s/$/.bmp/g'


And something similar could also be run through find.



Good Luck,
Kent
0
 

Author Comment

by:devildog1775
ID: 16973133
and even one line... :-) tks
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 16975174
Hi devildog1775,
> and even one line... :-) tks

Why use two, when one will do?   :~}


Kent
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question