Page 1 of 1

how to command line replace string with multi-line txt

Posted: Mon Oct 30, 2006 8:36 pm
by ttdaba
AFR looks great. Have scanned throught the help file and not sure how to do this. I just need to use afr in command line mode to s&r a bunch of .html files to replace a given string with multiple lines from a file. For example: search all files in given directory for "string-a" and replace with all text from replace.txt which contains:

this is line 1 which could contain a ton of html code, asp code, java code
this is line 2, more of the same
this is line 3, more of the same
etc.

Thanks again.

Posted: Wed Nov 01, 2006 9:09 am
by Abacre
Are you sure you want to take the replace with part from the file
(replace.txt)? How many files like replace.txt do you have then?

The most simple way is to use regular expressions. Go to Batch replace
part, check "Use regular expressions".
Then you may use \r\n as line separators.

So in your example it will be:

this is line 1 which could contain a ton of html code, asp code, java
code\r\nthis is line 2, more of the same\r\nthis is line 3, more of the same

But I am not sure that you can pass such long text into command line.