Xref: utzoo comp.unix.questions:21861 comp.lang.perl:1236 Path: utzoo!attcan!uunet!munnari.oz.au!metro!pta!mcc!chris From: chris@mcc.UUCP (Chris Robertson) Newsgroups: comp.unix.questions,comp.lang.perl Subject: Re: using variable in a regular expression Message-ID: <106@mcc.UUCP> Date: 1 May 90 11:44:53 GMT References: <4122@uudell.dell.com> <1990Apr20.231018.512@iwarp.intel.com> <40438@apple.Apple.COM> <6358@star.cs.vu.nl> <6400@star.cs.vu.nl> Reply-To: chris@mcc.UUCP (Chris Robertson) Organization: MCC Software Group, Sydney, Australia Lines: 17 In article <6400@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >In article <6358@star.cs.vu.nl> I wrote: [Re using a shell variable in a sed expression] >)... What would happen if $1 were to contain a slash? >)I guess sed wouldn't be so pleased with that. In order to avoid this, make your sed delimiters something uncommon, like ^A, or my own favourite, ^V. Or even some fairly ordinary character not likely to occur in a variable, like ";" -- e.g.: sed -e ";$original;$new;" $file > $newfile Most sed's I've encountered will accept this. -- "Down in the dumps? I TOLD you you'd | Chris Robertson need two sets..." | chris@mcc.pyrsyd.oz