On Mon, Dec 13, 2004 at 04:41:45PM -0700, Grant Robinson wrote:
> In this case I did just need to view it, and less worked great.  But
> I needed to edit it, the question still remains, are there any
> editors that will work as well as less (it took less than a second
> to open, and only took 8-10 seconds seek down 900,000 lines.  Any
> editors that can do that (or something close)?

Here, allow me to code one up for you real quick:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>

/**
 * Usage: open_seek_write filename offset data
 */
int main(int argc, char * argv[])
{
        int fd = open( argv[1], O_RDWR );
        lseek( fd, atoi( argv[2] ), SEEK_SET );
        write( fd, argv[3], strlen( argv[3] ) );
        close( fd );
}

To delete a region, just overwrite with whitespace (mysql, or whatever
you're using, should ignore it).  To insert a region... well, I'm not
sure there's a fast way to do that.

Mike

Attachment: signature.asc
Description: Digital signature

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to