Change entries in a txt with data from another txt

Hello everyone,
I have a doubt.
I have two identical TXT files. One in English and one in Portuguese. I need to change the entry of the file in English by that of the file in Portuguese, as shown in the image. I need to change only what is marked on all lines. Is it possible to do that. I read the files and split the strings, but it’s giving me different values. Any tips

Hello @KMota

Have you tried with regex code ? I think this can fix ur issue.

Kindly,

1 Like

do you need this to be done inside a process? those keys are always the same or are them dynamic?

1 Like

quick and dirty could be:

txt.replace(“Oops, something went wrong. Pleas try again later!”,“Ops, ocorreu um erro. Tente…”)

1 Like

Hello @mz3bel

There are 4300 lines, I don’t know how to apply the regex in this case

Hello,

Only in one file (actually 4), but only once. . is a json file actually

so you only need to change the first 4 keys?

The best way i think:
1-Is to create a object with all ur parametre
2-Create a table (sql or csv) with each trad

Hi @KMota,
Read the text files into a string variable using Read Text File activity
Then convert the string to json object using deserialize json activity
Now you have a jsonObject output
Here you can set value to any key in the json object by key like

jsonObject(“INTERNAL_ERROR”) = " your Portuguese text"

Similarly for another lines too.

And atlast, write the jsonObject to a text file using Write text file activity.

2 Likes

Thanks @shankm
I had forgotten about the desserialize json activity

:slight_smile:

1 Like

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