Replacing word in text file

Hello Community,

I have a text file with 1000 lines, Is it okay to save it to a variable and then use replace function to do the replacement?

Can a string variable hold up to 10000 Lines of text?
Or is there a better way to replace these large text files?

Thank you

Hi @hansen_Lobo

  1. Use the “Read Text File” activity to read the contents of the text file into a string variable.

  2. Use Assign activity

modifiedText = originalText.Replace("wordToReplace", "replacementWord")
  1. Use the “Write Text File” activity to write the modified text back to the same text file.

Regards
Gokul

Hi @hansen_Lobo

1000 lines in text file is doable via string manipulation. Or you can also use Regex to achieve it.

Thanks.

Can a string variable hold up to 10000 Lines of text?

Can a string variable hold up to 10000 Lines of text?

Thanks for the explanation on how to do it.

Yes @hansen_Lobo , Have you tried it, if not just try and let us know

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