cc: tina.harriott.mathemat...@gmail.com
Subject: Re: [ast-users] Edit 10GB file with fixed size records
--------

> Does ksh have an API to edit a file at a specific position pos1, read
> n1 bytes, and write n1 bytes at that position without truncating the
> file? I need this to do edit a file in place without reading and
> writing it completely each time.
> 
> Tina
> -- 
> Tina Harriott  - Women in Mathematics
> Contact: tina.harriott.mathemat...@gmail.com

Yes, it does.

The redirection operator <> opens the file for reading and writing.

The operator <# can be used to seek to a location in the file.  If
it is followed by ((expr)) it is evaluated as an arithmetic expression
to get the seek pointer.  If followed by a string, it seeks to the next
line containing that string.

read -N n1
reads count bytes that the current location and
printf can be use to write n1 bytes after seeking back.

David Korn
d...@research.att.com
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to