Article View: news.software.readers
Article #22894Re: shell script to clean up .newsrc files?
From: Kim DeVaughn
Date: Sat, 15 Jun 1996 00:00
Date: Sat, 15 Jun 1996 00:00
85 lines
3381 bytes
3381 bytes
In article <4ppmh7$rr1@panix3.panix.com>, Tom Betz <tbetz@panix.com> wrote: | | A long time ago, in a Usenet far away, somebody wrote and posted | a shell script that went through .newsrc files and cleaned them up, | taking out all the commas and making every Newsgroup look like: | | comp.os.xenu: 1-982763 | | or: | | comp.os.ms-dos! 1-645763 | | I used it once, and it worked great, but I have lost it over | the years. Will someone who still has it please email it to me, | or post it here, or both? Attached is what I use (with perl). As written, it leaves the subscribed groups [:] alone, and only cleans up the unsubscribed [!] ones. If you *really* want to (in effect) catchup the subscribed ones, as you imply above, you'll need to modify it slightly. You may also want to blow off your .rnsoft and .rnlast (if using trn), or other "pointer files" if using some other reader that creates such things. I invoke the script using these csh aliases: alias trnclean "rm -f ~/.rnlast ~/.rnsoft" alias nupd "clean.newsrc;trnclean" Thanks to Tom Christiansen for the original script ...! [cc: emailed] /kim vvvvv snip vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # From: Tom Christiansen <tchrist@mox.perl.com> # Newsgroups: news.software.readers # Subject: Re: trn: clean up .newsrc file? # Date: 21 Apr 1995 22:51:11 GMT # Message-ID: <3n9csv$3g5@csnews.cs.colorado.edu> # Organization: Perl Consulting and Training # # # In article <arnsteinD6G5y0.F9M@netcom.com>, # David Arnstein <arnstein@netcom.com> wrote: # # > I use trn 3.4.1. Trn's powerful cross-referencing features cause my # > .newsrc file to fill up with long lists of article numbers, mainly in # > groups that I am not subscribed to. As a result, my .newsrc file is # > over 750 Kbytes long! # > # > Most of the article numbers have long since been expired on my news # > server, anyway. # > # > Is there a trn command that will get rid of article numbers that have # > expired? Any similar "clean up" features? # # I believe you'll find that this does what you want: # # perl -i.old -pe 's/!.*\D(\d+)$/! 1-$1/' ~/.newsrc # # Poor csh users will probably have fun with the exclamation marks: # # perl -i.old -pe 's/\!.*\D(\d+)$/\! 1-$1/' ~/.newsrc # # which works even in noncsh. # # If you have perl5, you can simplify your pattern to: # # perl5 -i.old -pe 's/!.*?(\d+)$/! 1-$1/' ~/.newsrc # # But it's not strictly necessary. (well, maybe for those "Newsgroup!1-100" # cases without whitespace.) # # --tom perl -i.old -pe 's/\!.*\D(\d+)$/\! 1-$1/' ~/.newsrc ^^^^^ snip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Technical Details
Message-ID:
<4pvn9u$cjo@jobe.shell.portal.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<4ppmh7$rr1@panix3.panix.com>Show Full Headers
Complete Article Headers
Message-ID: <4pvn9u$cjo@jobe.shell.portal.com> Subject: Re: shell script to clean up .newsrc files? Date: Sat, 15 Jun 1996 00:00:00 +0000 From: kim@shell.portal.com (Kim DeVaughn) References: <4ppmh7$rr1@panix3.panix.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 160391490 Organization: Kim's Home for Wayward Cocktail Waitresses Newsgroups: news.software.readers Summary: A perl of wisdom ...