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

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!mcsun!sun4nl!fwi.uva.nl!janw
  3. From: janw@fwi.uva.nl (Jan Wortelboer)
  4. Subject: Re: Question on sed
  5. Message-ID: <1993Jan26.105005.21608@fwi.uva.nl>
  6. Sender: news@fwi.uva.nl
  7. Nntp-Posting-Host: mail.fwi.uva.nl
  8. Organization: FWI, University of Amsterdam
  9. References: <1993Jan24.102643.63110@cc.usu.edu> <halverso.727899661@staff.tc.umn.edu> <C1E9Mp.v4@cmie.ernet.in>
  10. Date: Tue, 26 Jan 1993 10:50:05 GMT
  11. Lines: 37
  12.  
  13. rs@cmie.ernet.in (Rajappa Iyer) writes:
  14.  
  15. >halverso@staff.tc.umn.edu (Chris Halverson) writes:
  16.  
  17. >>In <1993Jan24.102643.63110@cc.usu.edu> sl0k3@pluto.ee.usu.edu (Saturn) writes:
  18. >>>Hi,
  19. >>>    My appologies if this is a FAQ.  
  20. >>>How does one apply some editing commands to
  21. >>>a file using sed without having to redirect
  22. >>>output to another file.  I want the changes to 
  23. >>>appear on the same file.
  24.  
  25. >>Use Perl instead. It can does all of the sed commands and will write
  26. >>back to the file.
  27.  
  28. >Or try something like this:
  29.  
  30. >sed <sed commands> file > /tmp/$$ && mv /tmp/$$ file
  31.  
  32. The answer is more simple if you simple want to edit a file use ed
  33. sed is only the stream version of ed
  34.  
  35. e.g.
  36.  
  37. ed file <<!
  38. /search/s/aap/mies/
  39. w
  40. q
  41. !
  42.  
  43.  
  44. Jan.
  45. -- 
  46. Jan Wortelboer,  University of Amsterdam
  47.                  Computer Science Department  Email: janw@fwi.uva.nl
  48. Unix             Kruislaan 403 Kamer F003     Phone: +31 20 525 7501
  49. systems manager  1098 SJ AMSTERDAM            Fax  : +31 20 525 7490
  50.