How to scrub a document of all text between brackets with find and replace

Posted on

QUESTION :

I have a log file and I need to find all instances of <password> hash here </password> and remove the hash and replace it with some dummy text like aaa-aaa-aaa-aaaa.

The recurring search argument is anything that matches a bracket that starts with <password> and ends with </password>. All the hashes being replaced will be different.

What’s the easiest way to go a bout this? The log is on a windows machine. Probably easiest would be to use MS word for me, unless it’s achievable with wordpad, notepad, or some other light weight editor like textpad.

thanks

ANSWER :

You can do it with SciTE (very lightweight), but any editor that supports regular expressions should be fine.

Use the replace feature ->

 Find what - <password>.*</password>
 Replace with - <password>helloWorld</password>

Regular expression – yes

FARt.exe

 http://fart-it.sourceforge.net/

Command line for you

 fart "filepath"  "<password> hash here </password>" "<password>sdasdadaasd</password>" 

Leave a Reply

Your email address will not be published.