Conditionnal occurence modification

S

Steve Hémond

Hi,

I post something about that issue earlier : I want to modify a text-file
that looks like this : (assume that * are random characters)

PS1****PW0.50****PW1****PW2.5***PS4*****PW5.5***PS1***PW4.2***PW2.0***

...and so on.

For each PSx I have to set the PWx's to the same value :

PS1 = PW5.0
PS2 = PW10.0
PS3 = PW15.0

I have to scan the file using this logic :

1. Scan the file until a PSx is found.
2. Scan until the next PWx and replace it to the PSx's correct value.
3. Continue scanning and replacing all PWx's until the next PSx is found.

Actually I can replace the PWx's between the PSx only if there is an even
number of PWx between the PSx.

Any ideas?

Thanks in advance,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top