Windows Script to search a files and delete value

Looking for a script that will search/delete a line in an ini file. The script should only delete the line that matches, nothing else.

Inside the script will look like this.

window.x=[some #]
window.y=[some #]
window.width=[some #]
window.height=[some #]



The regular expression capability in FINDSTR is fairing simplistic, so I would keep it simple and just look for each patter to be ignored:



Which line do you want to delete?

There will be nothing else on the line?

~bp



At a command line (or in a BAT file) you could just do:
findstr /v /r /c:"window.width=[[0-9]*]" in.txt > out.txt

to eliminate that line for example.

~bp



This worked nicely!
I used findstr /v /r /c:"window.height=*"
How can I add the other search criteria into the same findstr line? ( "window.width=*" , "window.x=*", "window.y=*" )



This seems to work. I don't see why I have to add the outside "[" without the closing "]". Maybe Bill or another expert can explain why. Anyway, it works.

findstr /v /r /c:"window.[=[[0-9]*]" in.txt



The regular expression capability in FINDSTR is fairing simplistic, so I would keep it simple and just look for each patter to be ignored:

Share this

Related Posts

There was an error in this gadget