Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
I've looked around for a one line solution ( as bash offers ) to replace part of filename.
Given that a folder has image sequence like
Need to replace only v000 with v09 ( say ). How is it possible (throughout directory).
Rui F Ribeiro
55.5k2626 gold badges146146 silver badges225225 bronze badges
asked Feb 11, 2014 at 8:22
28311 gold badge33 silver badges1212 bronze badges
If you have the unix command
rename installed you can do this trivially like this:
$ rename v000 v09 *.jpg
$ ls -1
NOTE: This is using the
rename implementation that's included with the package util-linux.
answered Feb 11, 2014 at 8:39
361k114114 gold badges762762 silver badges869869 bronze badges
for f in $(ls ve2*); do mv $f $(echo $f | sed s/v000/v09/g ); done
If you want to make it recursive, you could use find instead of ls ve2*
answered Feb 11, 2014 at 8:44
Not the answer you're looking for? Browse other questions tagged