Re: Global Change in text files
- From: Michael Bednarek <ROT13-abfcnz-zo@xxxxxxxxxx>
- Date: Thu, 22 Sep 2005 13:15:16 +1000
On Wed, 21 Sep 2005 08:40:47 -0400, "Jeff Belorit"
wrote in microsoft.public.windows.server.scripting:
>I have about 100 .txt files in a directory that I need to make a global
>change to. I think there is a way to do this with the find command in a
>batch program.
>
>Currently, all of the files have lines of text that point to the path
>c:\inetpub\ftproot. I need to modify this path to
>c:\ftpdata\users
>
>Does anyone have a quick script to do this?
Looks like a job for SED; see: (<http://www.student.northpark.edu/pemente/sed/sedfaq4.html#s4.41>
and <http://www.student.northpark.edu/pemente/sed/sedfaq4.html#s4.43>),
or other similar utilities, e.g. <http://www.funduc.com/search_replace.htm>.
With SED, this should work:
FOR %n IN (*.txt) DO SED "s/c:\\inetpub\\ftproot/c:\\ftpdata\\users/g' %n >%~nn.new
--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
.
- Follow-Ups:
- Re: Global Change in text files
- From: Jeff Belorit
- Re: Global Change in text files
- Prev by Date: Re: Is there a Monad Roadmap?
- Next by Date: Re: need to create DNS records in AD via vbscript... can i?
- Previous by thread: need to create DNS records in AD via vbscript... can i?
- Next by thread: Re: Global Change in text files
- Index(es):
Relevant Pages
|