Re^2: Regular Expression delimiters

Maarten Litmaath maart at cs.vu.nl
Thu Apr 13 02:16:42 AEST 1989


chris at 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 at bilpin). |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list