Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7178609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:57:20+00:00 2026-05-28T16:57:20+00:00

I’ve got a 2GB text file and a 500MB text file. The 2GB is

  • 0

I’ve got a 2GB text file and a 500MB text file. The 2GB is in a slightly daft format: e.g. sample:

CD 15
IG ABH
NU 1223
**
CD 17
IG RFT
NU 3254
**

Where ** is the marker between records.

I need to extract all the values of NU where CD is a certain value; I then need to go through the 500MB text file and then match all the records in there with the NU values from the 2GB file and then write those to a new file.

I know PHP. This is trivial in PHP, apart from the size of the file. Even using fgets to read a line at a time doesn’t really work as it takes for ever and then crashes my computer in localhost (under XAMPP apache.exe grows to use up all system memory). Plus doing it in PHP would be a pain (it’s for non-technical people to run, so they’d need to download the 2GB and 500MB from the FTP server when they become available each week; upload them to my FTP server which is flaky on such large file sizes; run a script on my server that takes ages etc).

I know a bit of VBScript, no Perl, no .NET, no C# etc. How can I write a Windows-based programme that will run locally, load the files a line at a time, and not crash due to the file size?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:57:22+00:00Added an answer on May 28, 2026 at 4:57 pm

    The following declares a VBScript function to read a source file 1 line at a time and write the destination file only if the cdfilter string matches the cd in the record:

    Option Explicit
    
    Const ForReading = 1
    Const ForWriting = 2
    
    Sub Extract(srcpath, dstpath, cdfilter)
      Dim fso, src, dst, txt, cd, nu
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set src = fso.OpenTextFile(srcpath, ForReading)
      Set dst = fso.OpenTextFile(dstpath, ForWriting, True)
      While (not src.AtEndOfStream)
        txt = ""
        While (not src.AtEndOfStream) and (txt <> "**")
          txt = src.ReadLine
          If Left(txt, 3) = "CD " Then
            cd = mid(txt, 4)
          End If
          If Left(txt, 3) = "NU " Then
            nu = mid(txt, 4)
          End If
          If txt = "**" Then
            If cd = cdfilter Then
              dst.WriteLine nu
              cd = ""
              nu = ""
            End If
          End If
        Wend
      Wend
    End Sub
    
    Convert "input.txt", "output.txt", "17"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a reasonable size flat file database of text documents mostly saved in
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.