Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!rutgers!bpa!cbmvax!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.questions Subject: Re: sed question Keywords: sed, regexp, Pnews, Rnmail Message-ID: <942@philmds.UUCP> Date: 30 Jan 89 17:00:36 GMT References: <17810@vax5.CIT.CORNELL.EDU> <938@philmds.UUCP> <4094@omepd.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Distribution: comp Organization: Philips I&E DTS Eindhoven Lines: 20 In article <4094@omepd.UUCP> merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) writes: |In article <938@philmds.UUCP>, leo@philmds (Leo de Wit) writes: || sed '/^Reply-To:/s/()/('$REALNAME')/g' your_file || || Since the $REALNAME is outside quotes, it is expanded by the shell. | |Including the spaces. This will break for REALNAME="Randal L. Schwartz". |Try instead: | | sed "/^Reply-To:/s!()!(${REALNAME-$USER})!g" your_file | |where "!" should probably be replaced with a control-G or some other |very very unlikely character in REALNAME for safety. If you had taken the trouble to read my own follow-up (sent out 5 min. later, where I use the " quoting too), this reply hadn't been necessary. You were probably as hasty to reply to my article as I was to get it out 8-). Perhaps I'd better cancelled the first message ... Leo.