Re: OT: Unix Geek Needed

This WebDNA talk-list message is from

2005


It keeps the original formatting.
numero = 63551
interpreted = N
texte = Clint Davis wrote: > How could this be modified so the action is performed on the original file > with no need for a backup? Can't be done, but it is a common newbie mistake. Once you open the destination for overwriting (i.e, with '>'), the existing file is truncated and the fgrep doesn't have anything to operate on, so the it returns immediately and the file has size 0. It is a very fast way to nuke a file, albeit by accident. Without using a shell (i.e. with a C program), it *is* possible to open a temporary file as the destination and then at the completion of processing atomically rename the temp file to the original filename, which will /look/ like no backup was involved. However, you still need sizeof(original file) + sizeof(new file) diskspace available. And, just to complicate things, if some process already has the file opened for append, the original rename will not break that connection (which is why I stated at the top that all processes writing to the file must be halted. For contrast, in Windows it is impossible to rename or delete an open file (which is very annoying when a virus-scanner blocks access to a small temporary file that you just want to delete during processing). John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748 ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: OT: Unix Geek Needed ( "Chris List Recipient" 2005)
  2. Re: OT: Unix Geek Needed ( John Peacock 2005)
  3. Re: OT: Unix Geek Needed ( Clint Davis 2005)
  4. Re: OT: Unix Geek Needed ( John Peacock 2005)
  5. Re: OT: Unix Geek Needed ( "Chris List Recipient" 2005)
  6. Re: OT: Unix Geek Needed ( Clint Davis 2005)
  7. Re: OT: Unix Geek Needed ( John Peacock 2005)
  8. OT: Unix Geek Needed ( Clint Davis 2005)
Clint Davis wrote: > How could this be modified so the action is performed on the original file > with no need for a backup? Can't be done, but it is a common newbie mistake. Once you open the destination for overwriting (i.e, with '>'), the existing file is truncated and the fgrep doesn't have anything to operate on, so the it returns immediately and the file has size 0. It is a very fast way to nuke a file, albeit by accident. Without using a shell (i.e. with a C program), it *is* possible to open a temporary file as the destination and then at the completion of processing atomically rename the temp file to the original filename, which will /look/ like no backup was involved. However, you still need sizeof(original file) + sizeof(new file) diskspace available. And, just to complicate things, if some process already has the file opened for append, the original rename will not break that connection (which is why I stated at the top that all processes writing to the file must be halted. For contrast, in Windows it is impossible to rename or delete an open file (which is very annoying when a virus-scanner blocks access to a small temporary file that you just want to delete during processing). John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748 ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ John Peacock

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Re:Searching for ALL / empty form field (1997) searching by date (1998) WebDNA 5.1 is now available! (2003) WebCat2 beta 11 - new prefs ... (1997) forming a SKU (1999) Ok here is a question? (1997) Template Cache problem (2000) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) [addlineitems] (1997) Setting up WebCatalog with Retail Pro data (1996) OT: 800x600 (2003) [WebDNA] calling a webDNA tmpl from PHP? (2008) New public beta available (1997) user submitted data Repost (2000) Languages (1997) [Announce]: Web server security and password protection (1997) Size limit for tmpl editor ? (1997) Cart Number sequence (1997) File commands and Wild Cards ?? (1998) calculating tax rates, mail order solutions and version 2 (1997)