Replace Words In a Text File

Hi,
I have a text file and I want to replace certain words with some other words.
How can that be done?

2 Likes

hey @ADITYA_MUKHERJEE
yourTextVar.Replace(“OrginalString”,“StringToBeReplaced”)
cheers

5 Likes

@ADITYA_MUKHERJEE Read the .txt file using Read Text file activity, the output will be string (Str).
Then, Do Str.Replace(“word to be replaced”,“new word”)

3 Likes

can you please elaborate?

Thanks, but can you please elaborate?

1 Like

okay consider
sample_string = My name is Aditya

now Replaced_String = sample_string.Replace(“Aditya”,“Pradeep”)

you’ll get the output like this My name is Pradeep

@ADITYA_MUKHERJEE
cheers

5 Likes

I am trying to replace words in a text file.

no, not like that!
get output from Read Text and use assign activity like above mentioned!

2 Likes

Thanks…it worked.

1 Like

cheers
@ADITYA_MUKHERJEE

1 Like

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