how to command line replace string with multi-line txt

General discussions about Advanced Find and Replace
Post Reply
ttdaba
Posts: 1
Joined: Mon Oct 30, 2006 8:30 pm

how to command line replace string with multi-line txt

Post by ttdaba » Mon Oct 30, 2006 8:36 pm

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.

Abacre
Site Admin
Posts: 1199
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Wed Nov 01, 2006 9:09 am

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.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests