The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Renaming Files (Multiple files)
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Renaming Files (Multiple files)
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
01-02-2009
Christoph Spohr
Registered User
Join Date: Sep 2008
Posts: 205
Hi,
shell variables inside '' are not expanded. So here
Code:
mv $i `echo $i |
sed
's/$myfile//'`
$myfile will not be substituted by "date '+ABC%Y%m%d'".
Either use "..." or no
sed
at all. Shell built-ins are enough. Try:
Code:
mv $i ${i/200[7-9][0-1][0-9][0-3][0-9]/}
HTH Chris
Christoph Spohr
View Public Profile
Find all posts by Christoph Spohr
Find Christoph Spohr's past nominations received
Find Christoph Spohr's present nominations given