Article 6567 of comp.lang.perl: Xref: feenix.metronet.com comp.lang.perl:6567 Path: feenix.metronet.com!news.ecn.bgu.edu!usenet.ins.cwru.edu!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!swrinde!cs.utexas.edu!asuvax!chnews!ornews.intel.com!ornews.intel.com!merlyn From: merlyn@ora.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: Perl .newsrc cleanup script? Date: 8 Oct 93 08:18:15 Organization: Stonehenge Consulting Services ; Portland, Oregon, USA Lines: 22 Distribution: world Message-ID: References: <2918j2$7r0@snoopy.cis.ufl.edu> <2920fs$irl@tymix.Tymnet.COM> NNTP-Posting-Host: wyeth.intel.com In-reply-to: rklute@enchanter.tymnet.com's message of 7 Oct 1993 21:08:12 GMT >>>>> In article <2920fs$irl@tymix.Tymnet.COM>, rklute@enchanter.tymnet.com (Robert Klute) writes: Robert> #!/usr/local/bin/perl Robert> while (<>) { Robert> chop; Robert> if (/([^!:]*[!:])\s?(\d+)([\-\,].*)[\-\,](\d+)$/) { Robert> print "$1 $2-$4\n";} Robert> else { Robert> print "$_\n"; Robert> } Robert> } Or... (just adjusting your code:) perl -pi.bak -e 's/^([^!:]*[!:])\s?(\d+)([\-,].*)[\-,](\d+)$/$1 $2-$4/' .newsrc Concise. Think Concise. :-) $_ = "Say what? Just another Perl hacker!"; s/.*(J.*)!/$1,/; print -- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095 merlyn@ora.com (semi-permanent) merlyn@kandinsky.intel.com (NEWSREADING ONLY) Quote: "Welcome to Portland, Oregon, home of the California Raisins!"