maart@cs.vu.nl (Maarten Litmaath) (04/12/89)
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
jdpeek@RODAN.ACS.SYR.EDU (Jerry Peek) (04/18/89)
In article <2286@fireball.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: > chris@mimsy.UUCP (Chris Torek) writes: > \(I also prefer a comma as the separator: sed 's,/,\\/,g'.) > > I use minus: sed 's-/-\\/-g' In cases like this, I use control characters (usually ^A or ^G). I try to put a comment line above -- so people will notice: # THE NEXT LINE USES CONTROL-A CHARACTERS AS THE sed SEPARATOR: sed "s^A${foo}^A${bar}^Ag" --Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY jdpeek@rodan.acs.syr.edu, SUNRIS::JDPEEK, jdpeek@suvm.bitnet +1 315 443-3995