Replicating Lines

General discussions about Advanced Find and Replace
Post Reply
GRDODD
Posts: 3
Joined: Sun Apr 23, 2006 10:03 pm

Replicating Lines

Post by GRDODD » Sun Apr 23, 2006 10:23 pm

I am trying to replicate a line of text in about 1000 different txt files.

I need to replicate the line of text which is contained in a php command into an entirely different PHP command, yet still keep the original php command in the txt file.

A sample of the php script might look something like this:

$keywords = "no trace camouflage";

The only thing that changes about this string among the 1000 files is the words contained between the " and "

I need to retain this string, but add a second string that contains HTML spaces like this:

$sprinkle = "no%20trace%20camouflage";
$keywords = "no trace camouflage";


Unfortunately not all of the character strings contain the same number of kewords. In the example given, 3 words were used "no", "trace", and "camouflage". In some of these txt files, the number of words may range from 1 to 6 or possibly 7.
A second example might be

$keywords = "no trace camouflage coat";

in which case I would need to replace it with 2 strings;

$sprinkle = "no%20trace%20camouflage%20coat";
$keywords = "no trace camouflage coat";




Any ideas on how to tackle this issue would be most appreciated.
Thanks
Good Hunting - Gerald
For God So Loved The World...You better learn the rest of the story!
Dodd Video Productions

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

Post by Abacre » Mon Apr 24, 2006 1:57 pm

Yes, it's possible to solve this task with Advanced Find and Replace.

Do the following:
Please download the latest version of the program:
http://www.abacre.com/download/afrexe.zip

This is only updated EXE file. You need to extract executable file from
zip archive into folder where the program is installed. So you will
replace old executable file by this new one.

Then:

Go to main menu - Action - Options - Batch Replace
check "Modifier E"
uncheck "Modifier S", "Modifier G"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
\$keywords.*=.*"(.*)";

Replace with:
$sprinkle = "<%=Replace("$1"," ","%20")=%>";\r\n$0

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

GRDODD
Posts: 3
Joined: Sun Apr 23, 2006 10:03 pm

Post by GRDODD » Tue Apr 25, 2006 5:35 pm

Roman, Thanks for the info. I tried each and every step just as you recommended. The results were not exactly what I expected.

Here is the text contained in one of the these text files before I used the Find & Replace utility.

<?

$description = "No trace camoflage backdoor page";

$keywords = "no trace camoflage";

?>


Here is what it looked like after executing the find & replace utility.

<?

$description = "No trace camoflage backdoor page";

$sprinkle = "

?>



Here is what it should have looked like:

<?

$description = "No trace camoflage backdoor page";

$keywords = "no trace camoflage";

$sprinkle = "N0%20trace%20camoflage";

?>


I'm not exactly certain if the problem was me not communicating exactly what I needed the Find & Replace utility to accomplish, or if it is a case of me not following the instructions you gave exactly. I downloaded the zip file and extracted the .exe file, then over wrote the existing .exe file, and tried to follow your instructions. I really appreciate the time you are taking on this. Any additional help will be greatly appreciated.
Sincerely
Good Hunting - Gerald
For God So Loved The World...You better learn the rest of the story!
Dodd Video Productions

GRDODD
Posts: 3
Joined: Sun Apr 23, 2006 10:03 pm

Post by GRDODD » Tue Apr 25, 2006 5:41 pm

Roman,
Please disregard my last message. I found my mistake. I really appreciate the help and will be purchasing this great utility.

Again,
Thanks for your help!
Good Hunting - Gerald
For God So Loved The World...You better learn the rest of the story!
Dodd Video Productions

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

Post by Abacre » Tue Apr 25, 2006 7:43 pm

Probably you did not enable Modifier E option.

Our result is the following:

<?

$description = "No trace camoflage backdoor page";

$sprinkle = "no%20trace%20camoflage";
$keywords = "no trace camoflage";

?>

I will send you default.cfg file for this solution by email.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

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