<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Re: [CentOS] script help</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>Try:<BR>
<BR>
# find <parent dir> -type d -name dir-192.168.\* -exec mv \{\} `echo \{\} | sed 's/192\.168\./10\.0\./'` \;<BR>
<BR>
That should recursively rename all directories from one naming scheme to another.<BR>
<BR>
-Ross<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: centos-bounces@centos.org <centos-bounces@centos.org><BR>
To: CentOS mailing list <centos@centos.org><BR>
Sent: Fri Nov 02 09:28:45 2007<BR>
Subject: Re: [CentOS] script help<BR>
<BR>
I run it but it has error.<BR>
<BR>
sed 's/^dir-192\.168/dir-10\.0/'`<BR>
sed: read error on dir-192.168.0.31: Is a directory<BR>
<BR>
<BR>
<BR>
--- Toby Bluhm <tkb@MidwestInstruments.com> wrote:<BR>
<BR>
> Toby Bluhm wrote:<BR>
> > adrian kok wrote:<BR>
> >> Hi Phil<BR>
> >><BR>
> >> thank you<BR>
> >><BR>
> >> But I have several hundred those pattern<BR>
> directories!<BR>
> >><BR>
> >> I did think to cat those directories in a file<BR>
> >> "olddir"<BR>
> >><BR>
> >> eg:<BR>
> >><BR>
> >> dir-192.168.30.0   dir-192.168.30.144<BR>
> dir-192.168.30.184<BR>
> >> ........................................<BR>
> >><BR>
> >> and sed 's/dir-192.168/dir-10.0/g' olddir ><BR>
> newdir<BR>
> >><BR>
> >> but i don't know how to move<BR>
> >> rename the directories in olddir to newdir<BR>
> >><BR>
> >> Thank you again<BR>
> >><BR>
> >><BR>
> >>  <BR>
> ><BR>
> > Assuming dir-192.168*  are all in one directory<BR>
> level, cd to that dir:<BR>
> ><BR>
> > for olddir in `ls -1 | grep dir-192.168`<BR>
> > do<BR>
> > newdir=`echo $olddir | sed<BR>
> 's/^dir-192.168/dir-10.0/'`<BR>
> > mv $olddir $newdir<BR>
> > done<BR>
> ><BR>
> ><BR>
><BR>
>  That sed line should be:<BR>
> 's/^dir-192\.168/dir-10\.0/'`<BR>
><BR>
><BR>
> --<BR>
> Toby Bluhm<BR>
> Midwest Instruments Inc.<BR>
> 30825 Aurora Road Suite 100<BR>
> Solon Ohio 44139<BR>
> 440-424-2240<BR>
><BR>
><BR>
> _______________________________________________<BR>
> CentOS mailing list<BR>
> CentOS@centos.org<BR>
> <A HREF="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos</A><BR>
><BR>
<BR>
<BR>
Send instant messages to your online friends <A HREF="http://uk.messenger.yahoo.com">http://uk.messenger.yahoo.com</A><BR>
_______________________________________________<BR>
CentOS mailing list<BR>
CentOS@centos.org<BR>
<A HREF="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos</A><BR>
</FONT>
</P>


<P></P>
<HR WIDTH="100%">
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

</BODY>
</HTML>