From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from doolittle.vetsci.su.OZ.AU ([129.78.148.2]) by archone.tamu.edu with SMTP id <18890>; Sat, 1 Feb 1992 12:35:40 -0600 Received: by doolittle.vetsci.su.oz.au id <49379>; Sun, 2 Feb 1992 05:35:07 +1100 From: John (I've got some bad news for you, sunshine) Mackin Date: Sat, 1 Feb 1992 12:02:44 -0600 To: The rc Mailing List Subject: Re: Match operator puzzlement In-Reply-To: <92Feb1.114911cst.18888@archone.tamu.edu> Message-ID: <199202020502.20639.rc.badig@vetsci.su.oz.au> X-Face: 39seV7n\`#asqOFdx#oj/Uz*lseO_1n9n7rQS;~ve\e`&Z},nU1+>0X^>mg&M.^X$[ez>{F k5[Ah<7xBWF-@-ru?& @4K4-b`ydd^`(n%Z{ Byron gives us: sed -e 's/\([^[*?]\)/''\1''/g' -e 's/''''//g' Damn good thinking. Top notch in fact. It is possible to make this work for input containing ', but in an indirect manner. I think you have to be indirect since I don't think a grep-style RE can do that. In practice, there is a neat enough solution: assume that newline doesn't appear in the input string and initially map ' into newline, then map that back into '' on output. As long as the character you pick doesn't occur in the input it's fine. Yes, it's a kludge, but I would be very surprised to find people with real applications for command-line patterns containing newline. I'm not prepared to say that it can't be done with an egrep-style (full) RE but I can't see a solution. If anyone has one please mail it to the list. Extending Byron's sed produces this (with $nl being a newline, as usual): sed -e 's/''/\' ^ $nl ^ '/g' \ -e 's/\([^[*?]\)/''\1''/g' \ -e 's/''''//g' \ -e 's/\n/''''/g' OK, John.