Jump to content

Script to Find and Replace within an INI file.


Recommended Posts

Posted

Hi all,

 

I was wondering if anyone had a simple VB Script to open up ALL the ini files in a folder and its subdirectories and do a basic find and replace so it would replace "REPLACEME" with "IMREPLACED" if you see what I mean.

 

Also does anyone know how to install Windows Remote Deployment Services silently on Windows Server 2003 (SP2 & R2)

 

Thanks

Posted (edited)

a one liner with sed and find

Cygwin

 

   find C:\  -type f  -name "*.ini" -exec  sed 's/REPLACEME/IMREPLACED/g'  > {} \;  

 

I not actually tried that, so might need some playing around with.

 

 

 

edit:

 

might be better with

 

#!/bin/bash
    for fl in *.ini; do
    mv $fl $fl.old
    sed 's/REPLACEME/IMREPLACED/g' $fl.old > $fl
    rm -f $fl.old
    done

Edited by CyberNerd

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...