Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re^2: Regular Expression delimiters Message-ID: <2286@fireball.cs.vu.nl> Date: 12 Apr 89 16:16:42 GMT References: <993@n8emr.UUCP> <6710@bsu-cs.bsu.edu> <16874@mimsy.UUCP> Distribution: comp Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 30 chris@mimsy.UUCP (Chris Torek) writes: \(I also prefer a comma as the separator: sed 's,/,\\/,g'.) I use minus: sed 's-/-\\/-g' \It is true that if "$ans" is "-n foo", then \ \ echo $ans \ \produces \ \ foo Let's see: ans=`echo x"$ans" | sed -e 's/.//' -e 's-/-\\/-g'` (assuming BSD echo) And now... the portable echo! No `-n', no escapes! % cat pecho : # portable echo hack: don't interpret backslash escape sequences cat << EOF $* EOF % -- "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam: it's probably wrong." (jim@bilpin). |maart@cs.vu.nl, mcvax!botter!maart