Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.unix.questions Subject: Re: novice sed ? Message-ID: <1991May6.160614.1172@iwarp.intel.com> Date: 6 May 91 16:06:14 GMT References: <1991May3.213550.17246@ge-dab.GE.COM> <1991May5.140740.12908@iwarp.intel.com> <304@carssdf.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Followup-To: poster Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 23 In-Reply-To: usenet@carssdf.UUCP (John Watson) [I tried mailing. It bounced. Where the heck is carssdf? And yes, further discussion to comp.lang.perl, please...] In article <304@carssdf.UUCP>, usenet@carssdf (John Watson) writes: | > perl -pe 'while (/,\s*$/) {$_ .= ; s/,\s*\n\s*/ /;}' out | | In this example, don't you have to set $* =1; to get the s/,\s*\n\s*/ to | match. | | John Watson No. $* is only for selecting whether ^ and $ match a begin/end-of-line within the buffer. \n will always match itself, as will \s match newline (and the other whitespace). The \n is in there to ensure that I kill the *right* comma and whitespace (which the sed solution doesn't guarantee). Just another Perl hacker (but of course, you knew that), -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/