rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: John (I've got some bad news for you, sunshine) Mackin <john@vetsci.su.oz.au>
To: The rc Mailing List <rc@archone.tamu.edu>
Subject: Re: Match operator puzzlement
Date: Sat, 1 Feb 1992 12:02:44 -0600	[thread overview]
Message-ID: <199202020502.20639.rc.badig@vetsci.su.oz.au> (raw)
In-Reply-To: <92Feb1.114911cst.18888@archone.tamu.edu>

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.


  reply	other threads:[~1992-02-01 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-02-01 17:49 Byron Rakitzis
1992-02-01 18:02 ` John Mackin [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-02-03 17:09 Byron Rakitzis
1992-02-02 20:20 Tom Culliton x2278
1992-02-01 19:46 malte
1992-02-01 18:43 malte
1992-01-31 21:01 Tom Culliton x2278
1992-02-01 16:02 ` John Mackin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199202020502.20639.rc.badig@vetsci.su.oz.au \
    --to=john@vetsci.su.oz.au \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).