Replicating Lines
Posted: 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
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