Page 1 of 1

exclude or include a text based on it's content

Posted: Tue Mar 07, 2017 5:29 pm
by fthomas
I have a situation where there are multiple text files but I only want to process the files that a have a certain line IN the file. Search and replace seemed like a possibility using the output files variable. However that seems to be all the files it processed. Is there a better way to accomplish this?

Re: exclude or include a text based on it's content

Posted: Wed Mar 08, 2017 9:02 am
by Support_Rick
If these are relatively small files .. then, do a loop through your files, set the file contents to a variable "FileContents", then use the "Contains" function see if "FileContents" has the value you're looking for. Condition based on results...

Re: exclude or include a text based on it's content

Posted: Wed Mar 08, 2017 3:43 pm
by fthomas
Do you mean using a Read task to store it in a variable? If so, isn't that a row by row examination and not the whole text file?

Then use an IF task to decide what to do with it?

Re: exclude or include a text based on it's content

Posted: Wed Mar 08, 2017 3:55 pm
by Support_Rick
Set Variable Task ... not a Read Task.

Then use an if condition to see if the variable "contains" the value you are seeking.

Re: exclude or include a text based on it's content

Posted: Thu Mar 09, 2017 1:02 pm
by fthomas
Thanks! That works perfectly!