Remove first line (CrLf) in text file

Hello everyone !

I work in a text file and i would like to delete the first line. My text file :

I want to delete the line number 1. I don’t know if i can use an assign with .Replace(vbCrLf, ???) or if i can use another method.

i have 3 text files like that with always the same issue.

Anyone what a method to do that ?

Thank you all for your help :slight_smile:

3 Likes

Hi
hope these steps would help you on this
–use a READ TEXT FILE activity and pass the file path of the text file
and get the output with a variable of type string named str_input
–now use a ASSIGN activity and mention like this
str_output = String.Join(Environment.Newline,Str_input.Split(Environment.Newline.ToArray()).AsEnumerable().Skip(1).ToArray())

Cheers @BCdev

7 Likes

Hi @BCdev,

I have developed a package to facilitate the Text file automation.

Here is the steps to remove the first line.

Regards
Balamurugan.S

4 Likes

Hi @balupad14,

Thank you for your help, it will be helpful ! :slight_smile:

Maybe you can resolve my other issue. When i want to read text file with a bigger size (500Ko-600Ko) i have an error message like that :

Error message : Impossible to recover the result of the task execution. Maybe, the message is so long to be treated"InkedMicrosoftTeams-image_LI

This error message come when i launch my robot with debugging mode and with UiPath Robot (attended robot). Do you know why and how i can resolve this ?

Thank you :slight_smile:

1 Like

if you don’t mind can you send me the file. if it confidential, you can share it via message.

Regards
Balamurugan.S

Hi,
I am doing screen scraping from SAP and I will get below kind of text for each scraping so my requirement is I have to remove first two lines and also the line which has only ‘*’ with out any string/text.

F … L.Row Text R …
… + … 1 … … + … + 2 + 3 … … … … 4 + 5 … … + … 6 … + … 7 …

  • Hello,
  • We received 25 items
  • Supplier: Amazon
  • Order: 12345678
  • Position:
  • Delivery note: XXXXXXX
  • Reference: D9986865
  • Quantity
  • Quantity Received
  • number
  • We can not check the markings because
  • some are returned.
  • XXXXXXXXX.
  • Edward on 19.01.2018

Could you please help me in this.
I have already tried with your code, it is removing first 1 line.

Thanks in advance.

1 Like

Did you use the package of @balupad14 ?

It works in my side.

Regards.

1 Like

Thank you @BCdev, Now you can get the package in UiPath Go ! It is published.

Hi @Neerugattu,

You can use the DeleteAt activity to remove the particular line.

Thank you
Balamurugan.S

1 Like

Can you share the link @balupad14 ?

I want to share that with my team.

Regards.

Hi @balupad14,

I have tried it but getting error: Illegal characters in path.

2 Likes

Hi,
Thanks for your reply’s.
my requirement is solved with below code.
StringOP = VFreeText.Replace(“*”,“”).ToString.
StringOP = String.Join(Environment.Newline,StringOP.Split(Environment.Newline.ToArray()).AsEnumerable().Skip(1).ToArray().Skip(2).ToArray())

Output:
Hello,

We received 25 items

Supplier: Amazon

Order: 12345678

Position:

Delivery note: XXXXXXX

Reference: D9986865

Quantity

Quantity Received

number

We can not check the markings because

some are returned.

XXXXXXXXX.

Edward on 19.01.2018

2 Likes

Hi ,

UiPath Go Link :slight_smile:

https://go.uipath.com/component/text-format-file-utility

Regards
Balamurugan.S

1 Like

hi @Neerugattu,
I will take a look and get back to you.

Thank you
Balamurugan.S

Hi @Neerugattu,

I have tested it here the Delete at is working fine. Can you share the source file(the text format file) ?
If it is confidential share a sample …

Thank you
Balamurugan.S

Hi,
As I told the data is from SAP screen scrapping and I can not share. I am scrapping data into a variable and passing variable to Text scope.

The text is already shared in above post but small correction is replace bullet(.) with ''. Probably this was auto converted( to bullet) when I copied from my system to this blog.

Thanks

Hi @Neerugattu,

Can you launch the robot with debug mode and see in variables panel the VFreeText Value and share with us ?

Regars.

1 Like

Hi @Neerugattu,

Here I have attached screen shot along with sample project which you have shown in the picture.

Neerugattu.zip (18.1 KB)

Regards
Balamurugan.S

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