Date: Tue, 9 Oct 2001 09:58:35 -0500 (CDT) From: Lee J Carmichael <lcarmich@wamnet.com> To: Chris Aitken <chris@ideal.net.au> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Perl, Expect and ^M's Message-ID: <Pine.SGI.3.96.1011009094947.133647I-100000@y.cops.wamnet.com> In-Reply-To: <20011008212140.W13268-100000@cactus.fi.uba.ar>
index | next in thread | previous in thread | raw e-mail
Hello Chris,
Since you want to do it in expect (or tcl which is expects language) use
tcl 'regsub' and the rough sytnax would be:
set row "The Cat Shat In The Hat^^Bad Cat^^Baaaaaad Cat"
regsub -all {\^\^} $row "\r" newrow
^^ this will return number of replacements
puts $newrow
^^ this outputs oddly with that replacement in the tclsh but I think this
is due to the '\r' with a normal character 'r' it seems to output fine.
Just as the normal disclaimer, you mileage may vary depending on wind
speed, sun spots and the like.
Take Care,
--------
Lee Carmichael WAM!NET Inc.
System Engineer 655 Lone Oak Rd Building E
651-256-5292 Eagan, MN 55121
> On Tue, 9 Oct 2001, Chris Aitken wrote:
>
> > HI All,
> >
> >
> > Example -
> >
> > "The Cat Shat In The Hat^^Bad Cat^^Baaaaaad Cat"
> >
> > I pull this line out of the DB, and I need to be able to replace the ^^'s
> > with ^M's to look like the following
> >
> > "The Cat Shat In The Hat^MBad Cat^MBaaaaaad Cat"
> >
> >
> >
> >
> > I would love to be able to do this at the very end process and replace all
> > ^^'s with ^M's in the Expect script, but it might be that I need to do it
> > in the Perl script.
> >
> >
> > Anyone able to give me a slight nudge with the clue stick?
> >
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.3.96.1011009094947.133647I-100000>
