[CentOS] script help

Fri Nov 2 13:28:45 UTC 2007
adrian kok <adriankok2000 at yahoo.com.hk>

I run it but it has error. 

sed 's/^dir-192\.168/dir-10\.0/'`
sed: read error on dir-192.168.0.31: Is a directory



--- Toby Bluhm <tkb at MidwestInstruments.com> wrote:

> Toby Bluhm wrote:
> > adrian kok wrote:
> >> 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
> >>
> >>
> >>   
> >
> > Assuming dir-192.168*  are all in one directory
> level, cd to that dir:
> >
> > for olddir in `ls -1 | grep dir-192.168`
> > do
> > newdir=`echo $olddir | sed
> 's/^dir-192.168/dir-10.0/'`
> > mv $olddir $newdir
> > done
> >
> >
> 
>  That sed line should be: 
> 's/^dir-192\.168/dir-10\.0/'`
> 
> 
> -- 
> Toby Bluhm
> Midwest Instruments Inc.
> 30825 Aurora Road Suite 100
> Solon Ohio 44139
> 440-424-2240
> 
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com