Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > MSDOS Programmer > Re: Extract Rec...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 477 of 494
Post > Topic >>

Re: Extract Records with DOS

by "Todd Vargo" <tlvargo@[EMAIL PROTECTED] > Jan 25, 2008 at 05:15 AM

ArarghMail801NOSPAM@[EMAIL PROTECTED]
 wrote:
> On Thu, 24 Jan 2008 14:51:48 -0800 (PST), samuel.k.silver@[EMAIL PROTECTED]
> wrote:
> 
>> I have a large file with  millions of records and I have to clean it
>> up and delete all lines that do not start with certain string (let's
>> say XYZ).
>> Can this be done in DOS?
>> Any suggestions on what approach/tools I can take here.
> 
> (untested)
> Assuming a text file(under 2 gig in size), in QBasic:
> 
> open "<infile>" for input as #1
> open "<outfile>" for output as #2
> 
> while not eof(1)
> 
>   line input #1,i$
> 
> ' keep lines that start with "<str in question>"
>   if left$(i$,<len of str>) = "<str in question>" then print #2,i$
> 
> ' if that string is "XYZ" : if left$(i$,3) = "XYZ" then print #2,i$
> 
> wend
> close
> system

find$ = "XYZ"
open "<infile>" for input as #1
open "<outfile>" for output as #2

while not eof(1)

  line input #1,i$

' keep lines that start with find$
  if left$(i$,len(find$) = find$ then print #2,i$

wend
close
system

-- 
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)




 5 Posts in Topic:
Extract Records with DOS
samuel.k.silver@[EMAIL PR  2008-01-24 14:51:48 
Re: Extract Records with DOS
"Jim Langston"   2008-01-24 16:38:58 
Re: Extract Records with DOS
ArarghMail801NOSPAM@[EMAI  2008-01-24 20:54:27 
Re: Extract Records with DOS
"Todd Vargo" &l  2008-01-25 05:15:10 
Re: Extract Records with DOS
ArarghMail801NOSPAM@[EMAI  2008-01-25 01:54:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 2:15:00 CDT 2008.