Solved

Rename large number of files

Posted on 2006-06-23
3
283 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 45

Accepted Solution

by:
Kent Olsen earned 500 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 45

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

691 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