From owner-freebsd-questions Tue Oct 9 7:59:30 2001 Delivered-To: freebsd-questions@freebsd.org Received: from cliff.wamnet.com (cliff.wamnet.com [208.50.249.21]) by hub.freebsd.org (Postfix) with ESMTP id 0566737B403 for ; Tue, 9 Oct 2001 07:59:25 -0700 (PDT) Received: from ndm.wamnet.com (ndm.wamnet.com [172.17.38.2]) by cliff.wamnet.com (8.11.4/8.11.4) with ESMTP id f99EwP41950668; Tue, 9 Oct 2001 09:58:26 -0500 (CDT) Received: from ds.cops.wamnet.com (ds.cops.wamnet.com [172.17.31.2]) by ndm.wamnet.com (8.9.1a/8.9.1) with ESMTP id JAA6481381; Tue, 9 Oct 2001 09:58:25 -0500 (CDT) Received: from y.cops.wamnet.com (y.cops.wamnet.com [172.17.31.43]) by ds.cops.wamnet.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) via SMTP id JAA83247; Tue, 9 Oct 2001 09:58:48 -0500 (CDT) Date: Tue, 9 Oct 2001 09:58:35 -0500 (CDT) From: Lee J Carmichael X-Sender: lcarmich@y.cops.wamnet.com To: Chris Aitken Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Perl, Expect and ^M's In-Reply-To: <20011008212140.W13268-100000@cactus.fi.uba.ar> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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