The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 09-28-2007
radoulov's Avatar
radoulov radoulov is offline
addict
 

Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,549
With zsh:

Code:
zsh 4.3.4% ls
file1_11  file2_11  file3_11
zsh 4.3.4% autoload -U zmv
zsh 4.3.4% zmv '*' '${f/_11/}'
zsh 4.3.4% ls
file1  file2  file3
If you have rename:

Code:
zsh 4.3.4% ls
file1_11  file2_11  file3_11
zsh 4.3.4% type rename
rename is /usr/bin/rename
zsh 4.3.4% rename 's/_11//' *_11
zsh 4.3.4% ls
file1  file2  file3
Otherwise:

Code:
$ ls
file1_11  file2_11  file3_11
$ for f in *_11;do mv "$f" "${f%_11}";done
$ ls
file1  file2  file3
Reply With Quote