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)


|