Fetch the data from specific position in the file

Hello Group,

I am a newbie to UI Path and need some advice on how to extract the data from a specific position in the file…

I have multiple files in a folder and I am currently moving the file from one folder to another but before moving the file, I need to do few actions like

In the file data looks like below…

The first line always starts with ISA and 9th postion to be replaced with "Test " and 16th to be replaced from “P” to “T” and second line always starts with GS and 4th position to be update to “Test”

ISA00 00 0911507047997 ZZL1160R0 2003052233U002000000090150P\GSPO47L1160R02003052233786X002003ST*850

"L1160R0 " Should be replaced with "Test "
“P” Should be replaced with “T”
“L1160R0” Should be replaced with "Test "

Can someone help me here.


Hi, welcome to the community!
If those things really have fixed positions and length, then it will be easy to replace, using string manipulation:
YourString.Remove(IndexToStartRemove, NumberOfCharToRemove)
to put in the replacement text:
YourString.Insert(IndexToStartRemove, "New Text")

Have a Look Here. Maybe some activities from this component can Help you by the Implementation

UiPath Go ! BalaReva.EasyText (Text Format File Utilities Package)

1 Like


I am trying to replace the 102 char position from “P” to “T” but unfortunately its replacing all occurrences of “P” to “T” in the whole file, irrespective of the psotion.

Exp I used: newlogdata.Replace(newlogdata.ElementAt(102),“T”)

My aim is to replace only 102 character in the file from “P” to “T”.

if you use what i explained above, it will work… i dont think there is a way to do all in one expression, you need to delete the 102th chat first and insert the new one after in the same position…

I did a substring and was able to add the “T” in the required position. Now its working as expected.

1 Like

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