[REBOL] Re: Deleteing lines from a big file
From: holger:rebol at: 17-Jul-2001 9:51
On Mon, Jul 16, 2001 at 03:23:40PM -0700, Ken Vincent wrote:
> Greetings,
>
> I'm looking for a way to delete problematic lines from very large data files (too large
for buffered access).
>
> row-to-delete: 25
> condition: "00000027"
>
> big-file: open/direct/lines %VeryBigDataFile.DAT
> skip big-file (row-to-delete - 1)
> line-to-check: first big-file ; confirm that this is the correct line to delete
> if (find line-to-check condition) <> none [remove line] <------------- Is there
some way to do this???
No, because operating systems do not allow this. File data is typically stored
consecutively, so you cannot delete something in the middle of a file. The best
solution is to copy the file to another file, line by line, in /direct mode,
skipping the line you want to delete. Then delete the old file and rename the
new one.
--
Holger Kruse
[holger--rebol--com]