Subject: Re: search and replace tool
From: Egor Duda <[email-masked]>
To: Yitzchak Scott-Thoennes <[email-masked]>
Cc: [email-masked]
Date: Fri, 20 Feb 2004 12:46:03 +0300

Yitzchak Scott-Thoennes wrote:
> 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).

Well, it creates new file, while old one is still present on disk. Space 
occupied by original file is freed only after handle is closed. What is 
deleted immediatly on linux is just directory entry, not the file itself.

Depending on the goal you wish to achive, cygwin may have drawbacks 
compared to linux or they may be equal.

If you want to search-and-replace in 700Mb file on 1Gb disk then you 
won't be able to do so either on linux or on cygwin.
If you wish to keep your real .bak file from being overwritten by 
search-and-replace script, then linux is slightly more convenient here, 
but on cygwin it's almost as easy to work around.

egor.

--
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/