home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7481 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  944 b 

  1. Path: sparky!uunet!pipex!doc.ic.ac.uk!uknet!comlab.ox.ac.uk!dominic
  2. From: dominic@onions.natcorp.ox.ac.uk (Dominic Dunlop)
  3. Newsgroups: comp.lang.perl
  4. Subject: In-place edit works on read-only files!!!
  5. Message-ID: <1992Dec17.151444.14888@onionsnatcorp.ox.ac.uk>
  6. Date: 17 Dec 92 15:14:44 GMT
  7. Sender: dominic@natcorp.ox.ac.uk (Dominic Dunlop)
  8. Organization: British National Corpus, Oxford University, GB
  9. Lines: 14
  10. Originator: dominic@onions.natcorp.ox.ac.uk
  11.  
  12. If I
  13.     perl -p -i -e 's/\bslug\b/snail/g' *.c
  14.  
  15. or whatever, it replaces files with edited versions thereof, even if
  16. the files are read-only.  I know why this happens, and I know in-
  17. place editing without back-ups is probably Not A Good Idea, but I'd
  18. say it was slightly buggy behaviour.  What does anybody else think?
  19.  
  20. (FWIW, perl 4.035, SPARC, SunOS 4.1.1, Sun CC 1.1)
  21.  
  22. (No, I didn't lose any data.  I was mucking about with copies precious
  23. files, not the real thing.)
  24. -- 
  25. Dominic Dunlop
  26.