home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 16037 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.6 KB

  1. Path: sparky!uunet!math.fu-berlin.de!ira.uka.de!Germany.EU.net!pki-nbg!pki-nbg.philips.de!ln_smr
  2. From: ln_smr@pki-nbg.philips.de (Stephen Riehm)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Question on sed
  5. Message-ID: <ln_smr.728207578@pki-nbg.philips.de>
  6. Date: 28 Jan 93 07:52:58 GMT
  7. References: <1993Jan24.102643.63110@cc.usu.edu> <halverso.727899661@staff.tc.umn.edu> <C1E9Mp.v4@cmie.ernet.in> <1993Jan26.105005.21608@fwi.uva.nl>
  8. Sender: news@pki-nbg.philips.de
  9. Reply-To: ln_smr@pki-nbg.philips.de
  10. Lines: 55
  11.  
  12. janw@fwi.uva.nl (Jan Wortelboer) writes:
  13.  
  14. >rs@cmie.ernet.in (Rajappa Iyer) writes:
  15.  
  16. >>halverso@staff.tc.umn.edu (Chris Halverson) writes:
  17.  
  18. >>>In <1993Jan24.102643.63110@cc.usu.edu> sl0k3@pluto.ee.usu.edu (Saturn) writes:
  19. >>>>Hi,
  20. >>>>    My appologies if this is a FAQ.  
  21. >>>>How does one apply some editing commands to
  22. >>>>a file using sed without having to redirect
  23. >>>>output to another file.  I want the changes to 
  24. >>>>appear on the same file.
  25.  
  26. >>>Use Perl instead. It can does all of the sed commands and will write
  27. >>>back to the file.
  28.  
  29. This is something I must get around to learning one of these days,
  30. I've got it installed, the manuals are [somewhere] on my desk, but the
  31. pressures of work never let me play with the damn thing, anyway...
  32.  
  33. >The answer is more simple if you simple want to edit a file use ed
  34. >sed is only the stream version of ed
  35.  
  36. OK, I used ed the other day to edit many (about 100) files, however, I
  37. found I had to go about it rather awkwardly, ie: I had to do the
  38. following (in tcsh):
  39.  
  40.     foreach file ( $list_of_files)
  41.     > ed $file < ed_script
  42.     > end
  43.  
  44. because I couldn't sus out how ed can handle more than one file at a
  45. time. Does anyone have any clues as to how I might handle something
  46. like:
  47.     ed $list_of_files < ed_script
  48.  
  49. I am of course assuming that there might be a way to tell ed to move
  50. onto the next file from within the script, but, if this is possible,
  51. then is it also possible to re-use the same script on each file?
  52. (some sort of primitive loop with a branch and a write for each file or
  53. something?) (I haven't found it in the man page, if such commands
  54. exist.)
  55.  
  56. thanks in advance
  57.  
  58. --------------------------------------------------------------------
  59. Stephen Riehm           Configuration Management          _-_|\ 
  60. ln_smr@pki-nbg.philips.de  Philips Kommunikations Industrie  /     \
  61. Work: +49 911 526 2975       Nu"rnberg, Germany             \_.-.!/
  62. Fax:  +49 911 526 3678       "I was there, now I am here!"          v 
  63. "My company speaks another language, I CAN'T speak on its behalf"
  64. PS: You may think I am joking, I can't speak the language that well so
  65.         PLEASE DON'T REPLY IN GERMAN!
  66.              - thanks -
  67.