Replace once in a line + add once

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Post Reply
Posts: 1
Joined: Tue Sep 07, 2010 12:46 pm

Replace once in a line + add once

Post by barraba » Tue Sep 07, 2010 12:56 pm

I think this kind of work cannot be done with standart functions, if not - please, help me out!

I have file with text lines split by ENTER

i need to:

Parse line by line
Find inline "text1" replace it with "text2" , if once replaced in line find next "text1" in this line and replace with "text3" and so on to "text4"
If "text1" found only 2 times, add "text4" to the end of the line
If there is no "text1" in the line, add "text2", "text3", "text4" to the end of the line

please help .

User avatar
DataMystic Support
Site Admin
Posts: 2238
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia

Re: Replace once in a line + add once

Post by DataMystic Support » Mon Sep 13, 2010 11:04 am

Inside a 'Restrict to each line in turn' filter,
add 3 search and replaces, each with the option 'Replace Once Only' checked.

Then use a separate restrict to lines NOT matching 'text1', and inside it, add a 'Add Right Margin' filter with text of

Simon Carter, - Insulin dose calculator for Type 1 diabetes - 250,000 free software downloads

Post Reply