Check Position of My Word and Delete Lines before and after it's related line

Sounds good :slight_smile: - although the issue is solved, I’d still recommend taking a look at the .xaml I uploaded for the reasons I mentioned in the previous comment

2 Likes

@Dave, I use it unfortunately it’s not working, no changes for the input file !!!

My uploaded file isn’t changing the input file. It is using a write line activity to output the string selected. Feel free to add a ‘write text file’ activity to save it back to a text file if that’s the desired output. I would recommend NOT changing the input file though, and instead creating a separate output file

1 Like

I know what you mean, but there is not output even in “Write Line”:
image

Did you make sure to change the file name so it matches your file? Make sure to include the full file path instead of relative path if needed (E.g. “C:\temp\myfolder\myfile.txt” instead of just “myfile.txt”)

Did you also make sure to update the if statement so it matches the word you’re looking for? Make sure it is written in all CAPS in your if statement since it is using str.ToUpper() on the input text

Everything worked perfectly when I tested it. See the below 2 areas where you have to make sure it matches your file name & word

changename1

change2

1 Like

Of course I did those changes , otherwise it will report an error instead of not showing anything:

In the if statement, change to “ABERKAN”

It is not catching it because it is checking the input string.ToUpper() so all are upper case characters. The .Contains() method is case-sensitive in it’s comparison, so i always recommnd converting both the input string and the string you want to check to upper case to ensure you find the words.

The .ToUpper() portion is a trick to keep in mind for this project & future projects as it will help prevent some troubleshooting headaches, especially if your input is a free-form text :slight_smile:

1 Like

Excellent idea @Dave, YES definitely, when removing this ToUpper, I’m able to get output :+1:

2 Likes

Great @Dave​:clap::clap::clap:

1 Like

Thanks both for your efforts and ideas, I appreciate :+1:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.