Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!blake!ogccse!littlei!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.questions Subject: Re: sed question Keywords: sed, regexp, Pnews, Rnmail Message-ID: <4094@omepd.UUCP> Date: 29 Jan 89 19:58:56 GMT References: <17810@vax5.CIT.CORNELL.EDU> <938@philmds.UUCP> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Distribution: comp Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 21 In-reply-to: leo@philmds.UUCP (Leo de Wit) 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. Enjoy. -- Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 on contract to BiiN (for now :-), Hillsboro, Oregon, USA. ARPA: <@iwarp.intel.com:merlyn@intelob.intel.com> (fastest!) MX-Internet: UUCP: ...[!uunet]!tektronix!biin!merlyn Standard disclaimer: I *am* my employer! Cute quote: "Welcome to Oregon... home of the California Raisins!"