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