Hi Phil
thank you
But I have several hundred those pattern directories!
I did think to cat those directories in a file "olddir"
eg:
dir-192.168.30.0 dir-192.168.30.144 dir-192.168.30.184 ........................................
and sed 's/dir-192.168/dir-10.0/g' olddir > newdir
but i don't know how to move
rename the directories in olddir to newdir
Thank you again
--- Phil Schaffner Philip.R.Schaffner@NASA.gov wrote:
On Fri, 2007-11-02 at 02:22 +0800, adrian kok wrote:
Hi all
how can I have script to rename the following directory pattern from
from
dir-192.168.30.0 dir-192.168.30.144 dir-192.168.30.184
To:
dir-10.0.30.0 dir-10.0.30.144 dir-10.0.30.184
If you are just renaming directories, or files, and not files in directories, the following should work:
for i in 0 144 184 ; do mv dir-192.168.30.$i dir-10.0.30.$i ; done
Or in a bit prettier form:
for i in 0 144 184 do mv dir-192.168.30.$i dir-10.0.30.$i done
Phil
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Send instant messages to your online friends http://uk.messenger.yahoo.com