On Saturday, Sep 13, 2003, at 05:52 US/Pacific, Sara wrote: [..]
2. I have DB with 4-8 digits number in each line e.g.

1238483
92933
09983433
093

The truncate function truncates the file very abruptly
[..]

well actually there are various types of DB's - some
such as SDBM_File will have 'information' at the start
of the 'block of data' that points to where the actual
data resides from the bottom of the block up - leaving
a potential 'space' in the middle of the data block.

What it sounds like you want is a 'compact' or 'purge'
function that will 're-write' the data into a new DB file.
Essentially the same issue that you ran into with wanting
to keep only the first "N-Blocks" of data from the file.

Since only 'you' know how the internals of the DB are laid
out, you will need to resolve what data in it is still good,
and which data in it is 'dead wood' that needs to be purged.

One trick to think about is

        move DB_File to OLD_DB_file
        create TMP_DB_FILE
        traverse OLD_DB_FILE and write to TMP_DB_FILE
        move TMP_DB_FILE to DB_FILE

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to