search and replace tool

Yitzchak Scott-Thoennes sthoenna@efn.org
Fri Feb 20 08:26:00 GMT 2004


On Fri, Feb 20, 2004 at 10:02:03AM +0300, Egor Duda wrote:
> huh? what do you mean "in-place"? linux writes new file to new place, it 
> just deletes .bak file afterwards, unlike cygwin.
> 
> deo@paltus:~$ echo aaa >xxx
> deo@paltus:~$ ls -i xxx
>  408096 xxx
> deo@paltus:~$ perl -i -pe 's/aaa/bbbb/' xxx
> deo@paltus:~$ ls -i xxx
>  408074 xxx
> deo@paltus:~$ cat xxx
> bbbb

That doesn't ever create a backup file or a temporary file.  It opens
xxx for read, unlinks it, opens xxx for writing, then reads from the
original handle and writes to the second handle.  This is AFAIUI
impossible on windows, but possible on things like unix and VMS (where
the unlink is skipped because of the automatic versioning).

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list