Read txt file and Split Each Row

Team,
Need to Read a txt file with 50K Records, Read each row and extract desired output such as Value 1 = 1 and Value 2 = Abby.

Input = Text File with 50K Rows
Sample Row Eg = 1~Abby~null~1~1~0~2009-10-27 05:00:00~2018-07-02 16:06:22~2023-09-06 12:40:03~2018-07-02 16:06:22~2009-10-28 01:13:34~
Value 1 =1
Value 2 = Abby

Thanks in advance

value1=inputtext.split(β€œ~”,c)(0)
value2=inputtext.split(β€œ~”,c)(1)

Hope it Helps!!

Hi @prerna.gupta ,
Have you try read text file to get String then generate data table
use regex with each row,
can you share image about your file?
regards,

@prerna.gupta

use match collection in regex so that you will all the rows values

collectionoutput=system.text.regularexpression.regex.matches(inputstr,β€œ\d{1}~[a-zA-Z]+”)

1 Like

File Snipet

Tried this one but not working.
PFA

TestFile.txt (597 Bytes)

by this you will get all the matches collection.
image

splitting the desired values

H! @prerna.gupta

You can try this xaml
practice task 4.xaml (11.5 KB)

you can see the output
image

Can you pls share Snapshot of xml code ?
Multiple lib and VB error while opening this one.

NOT working for me. can you share the snapshot of code as well ?

1 Like

@prerna.gupta

taskforum.zip (2.8 KB)

check this

1 Like

Take assign activity and create a variable
str_input= β€œYourText”

And pass in for each and give the condition like this = str_input.Split({vbLf},StringSplitOptions.RemoveEmptyEntries)

for value 1
image

for value 2
image

Thanks much this is working as expected.

1 Like

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