How to extract the specified data from the text file?

Hi,

I need to extract the specified values from the input text file and need to update the extracted values into output text file. Can someone guide me please how to extract it
Input.txt (283 Bytes)
Output.txt (77 Bytes)

kindly refer attached input & expected output file.

Thanks

Hi @jamunatj ,
you can use regex.

Thanks for the response @Shubham_Dutta

Please explain it how to use.

Hi,

Hope the following sample helps you.

image

Sample20220905-7.zip (3.3 KB)

Regards,

Hi @jamunatj ,
I am attaching the workflow which will help you to get the desired output.
Regex.zip (3.1 KB)

Thanks & Regards,
Shubham Dutta

Thanks for the response @Yoichi

I can’t run the script with actual input file, getting exception on Write Range: Object reference not set to an instance of an object.

I have tried the script with actual input file , Kindly check the attachment.
Sample20220905-7 (2).zip (3.7 KB)

Thanks,

Hi,

As there are blank data in some columns in your text, it’s difficult to map each data into column accurately.

For now, I modified some expression as the following. Can you try this?

Sample20220905-7v2.zip (3.9 KB)

Regards,

Thanks for the response @Yoichi,
I am getting exception on filter data table, Can we get each column into output file instead of specified column.

Thanks,

Thanks for the reply @Shubham_Dutta

I have tried the script but Unable to get expected output.
Regex.zip (3.9 KB)
Kindly refer the script & guide me as per the expected output file.

Thanks,

Hi @jamunatj ,
It is obvious you won’t get the desired output because in this format/pattern of your input text is changed, because regex works on a specified pattern.
Please confirm your exact text file pattern and what you want to extract, I mean the columns in input file.

Thanks & Regards,
Shubham Dutta

Thanks for the reply @Shubham_Dutta
Input.txt (2.1 KB)
Expected output .txt (844 Bytes)

I have attached input & expected output file . Kindly check it

Thanks,

Hi @jamunatj ,
I am attaching the code just run it you will get the desired output in output.txt
Regex.zip (3.2 KB)

But remember if the column pattern changes output will be different.

Have a nice day!

Thanks & Regards,
Shubham Dutta

Hi @jamunatj ,
I am attaching you the latest code please run it and see whether you get the desired output.
Regex.zip (7.1 KB)

Thanks & Regards,
Shubham Dutta

1 Like

I got expected output. Thanks for the support.

1 Like

Hi @Shubham_Dutta

Can we get the same output for multiple files with same column pattern? I have tried this code with multiple input file but unable to get output . Kindly refer the attached file & guide me to handle multiple files as well.
Thanks.

Regex.zip (8.3 KB)

Hi @jamunatj ,
your code was wrong you did not use read text file activity only without using that how will you get the text.
and final_str should be initialized in beginning.
I am sending you the correct code.
Sequence.xaml (14.6 KB)

And please create new thread for further queries.

1 Like

Noted my mistake . Sure , I will create new topic. Thanks @Shubham_Dutta

1 Like

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