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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-07-2009
Monkey Dean Monkey Dean is offline
Registered User
 

Join Date: May 2009
Posts: 15
How to remove numbers from filename

Hi all,

Can I edit this script:


Code:
find . -type f | while read i;do [ "$i" != "${i//abc/}" ] && mv "$i" "${i//abc/}" ;done

so that it will not only take out abc from the filename but also take out any numbers [Date, as in the year i.e. 2009 or any other year] that might be in the filename as well.

An example would be,

HTML Code:
Input:
filename abc 2009.mov

Output:
filename.mov
or

HTML Code:
Input:
filename.abc.2009.mov

Output:
filename.mov

Regards

Last edited by Monkey Dean; 05-07-2009 at 06:52 AM..
Sponsored Links