home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15912 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.1 KB  |  34 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!sangam!cmie!rs
  3. From: rs@cmie.ernet.in (Rajappa Iyer)
  4. Subject: Re: Question on sed
  5. Message-ID: <C1E9Mp.v4@cmie.ernet.in>
  6. Organization: Centre for Monitoring Indian Economy, Bombay
  7. References: <1993Jan24.102643.63110@cc.usu.edu> <halverso.727899661@staff.tc.umn.edu>
  8. Date: Mon, 25 Jan 1993 05:23:10 GMT
  9. Lines: 23
  10.  
  11. halverso@staff.tc.umn.edu (Chris Halverson) writes:
  12.  
  13. >In <1993Jan24.102643.63110@cc.usu.edu> sl0k3@pluto.ee.usu.edu (Saturn) writes:
  14. >>Hi,
  15. >>    My appologies if this is a FAQ.  
  16. >>How does one apply some editing commands to
  17. >>a file using sed without having to redirect
  18. >>output to another file.  I want the changes to 
  19. >>appear on the same file.
  20.  
  21. >Use Perl instead. It can does all of the sed commands and will write
  22. >back to the file.
  23.  
  24. Or try something like this:
  25.  
  26. sed <sed commands> file > /tmp/$$ && mv /tmp/$$ file
  27.  
  28. There is a cute script called ow (I think! Stands for overwrite.) in
  29. Kernighan and Pike's "The Unix Programming Environment" which makes it
  30. simple to do "in-place" substitutions.
  31. -- 
  32. Rajappa Iyer            rs@cmie.ernet.in (Preferred)
  33.                 riyer@shakti.ncst.ernet.in
  34.