sed question

Randal L. Schwartz @ Stonehenge merlyn at intelob.intel.com
Mon Jan 30 05:58:56 AEST 1989


In article <938 at philmds.UUCP>, leo at 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 at intelob.intel.com> (fastest!)
MX-Internet: <merlyn at intelob.intel.com> UUCP: ...[!uunet]!tektronix!biin!merlyn
Standard disclaimer: I *am* my employer!
Cute quote: "Welcome to Oregon... home of the California Raisins!"



More information about the Comp.unix.questions mailing list