The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: file renaming
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-13-2008
larne larne is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 11
file renaming

How can I rename files named like these
Code:
iq - 000001 - 2008.07.31 - 14.49.47 - location1.bin
iq - 000001 - 2008.07.31 - 14.49.47 - location12.bin
iq - 000008 - 2008.07.31 - 14.52.01 - location500.bin
to
Code:
iq_2008.07.31_14.49.47_location1.bin
iq_2008.07.31_14.49.47_location12.bin
iq_2008.07.31_14.52.01_location500.bin
I know how to loose the spaces, but I cant figure out how to skip the 00000X part of the file names. I cant substitute it since I don't know what number will be there? And I cant really cut it since I don't know how long the filename is since location may vary, or can I? Any ideas?
Best regards