Jump to content

Recommended Posts

Posted

I need to read a very long .txt file, add , delete or modify some rows and then save the resulting file as other .txt file

The data in the original file looks like this:

<empty row>

somedata1

somedata2

somedata3

<empty row>

somedata1

somedata2

somedata3

somedata4

somedata5

<empty row>

......and so on.

The second file :

<empty row>

newdata1

newdata2

somedata1

modified _data2

somedata3

<empty row>

newdata1

newdata2

somedata1

modified_data2

somedata3

somedata4

somedata5

<empty row>

.....and so on

I managed to do an VBS script that opens a series of excel files runs a VBA macro and then closes the excels.

Problem is, because of the many rows in the txt file, it's going sooooooo slowly and it will be nice not to install MsOffice or .NET Framework just to do this ; and after all why use VBA & Excel when I am almost sure VBS can handle the problem just fine.

Any ideeas ? :}

Thanks


Posted

open two textstreams, one for reading your existing file, one for writeing the modified data. then as you read each line write the line to the other file or modify/add and write it to the second file.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...