Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Newsgroups: comp.unix.questions Subject: Re: Regular Expression delimiters Message-ID: <6710@bsu-cs.bsu.edu> Date: 11 Apr 89 17:30:38 GMT References: <993@n8emr.UUCP> Reply-To: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 22 In article <993@n8emr.UUCP> lwv@n8emr.UUCP (Larry W. Virden) writes: > >Using sed as a simple example of a complex situation, how would one code >a shell program to invoke sed so that the arguments passed would always be >valid?... >sed -e /$ans/ filename First quote those slashes: # works from /bin/sh pattern="`echo "$ans" | sed -e 's/\//\\\\\\//g'`" sed -e "/$pattern/d" filename Count those backslashes carefully. What UNIX badly needs is a way of specifying out-of-band characters. The current quoting scheme causes problems because a level of quoting is removed at each level of interpretation. -- Rahul Dhesi UUCP: ...!{iuvax,pur-ee}!bsu-cs!dhesi