On Thu, 24 Jan 2008 14:51:48 -0800 (PST), samuel.k.silver@[EMAIL PROTECTED]
>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
--
ArarghMail801 at [drop the 'http://www.'
from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
To reply by email, remove the extra stuff from the reply address.


|