[comp.sources.misc] v09i037: Submission: fixnewsrc

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (11/28/89)

Posting-number: Volume 9, Issue 37
Submitted-by: Jeff Beadles <jeff@quark.wv.tek.com>
Archive-name: fixnewsrc

[ There is no makefile, or readme.  This is a short shell script, and there's
  "README" information at the top.]

Description:
This program will take the long lines created by rn in a .newsrc file,
and shorten with them.  (mark all articles as read)
It takes lines that look like this:

	talk.politics.misc! 1-1234,1235-19210,19212,19245-20322

and changes it to:

	talk.politics.misc! 1-20322

This helps, as if you try to use 'vi', it chokes on lines longer
than 1024 characters or so.  Also, it probably speeds up the
start-up time of rn.


	-Jeff
-- 
Jeff Beadles		Tektronix Inc.
jeff@quark.WV.TEK.COM


#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rwxr-xr-x  1 jeff         1296 Nov 26 16:55 fixnewsrc
#
echo 'x - fixnewsrc'
if test -f fixnewsrc; then echo 'shar: not overwriting fixnewsrc'; else
sed 's/^X//' << '________This_Is_The_END________' > fixnewsrc
X#!/bin/sh
X## Copyright 1989, Jeff Beadles.  Permission is granted to freely distribute.
X## Submittor:	Jeff Beadles   jeff@quark.WV.TEK.COM
X## Name:	fixnewsrc
X## Date:	Sun Oct  1 09:25:33 PDT 1989
X## Machine:	BSD Unix
X## OS:		unix
X## Version:	1.0
X## Synopsis:	Fix long lines in .newsrc
X##
X## Description:
X##
X##	This program will take the long lines created by rn in a .newsrc
X##	file, and shorten with them.  (mark all articles as read)
X##	It takes lines that look like this:
X##
X##  talk.politics.misc! 1-1234,1235-19210,19212,19245-20322
X##
X##	and changes it to:
X##
X##  talk.politics.misc! 1-20322
X##
X##	This helps, as if you try to use 'vi', it chokes on lines longer
X##	than 1024 characters or so.  Also, it probably speeds up the
X##	start-up time of rn.
X##
X##	When done, a backup copy of .newsrc is saved in .newsrc.old
X##
X
X## Change directory to the user's home directory
Xcd
X
X## Check for a .newsrc file.
Xif [ ! -f .newsrc ] ; then
X	echo "$0: .newsrc not found."
X	exit 1
Xfi
X
X## Check for a .newsrc.old file, and remove if needed.
Xif [ -f .newsrc.old ] ; then
X	rm -f .newsrc.old
Xfi
X
X## Make that backup first...
Xcp .newsrc .newsrc.old
X
X## There is a space and a tab in the first two []'s below.
Xsed '/!/s/^\([^ 	][^ 	]*\).*[,-][,-]*\([0-9][0-9]*\)$/\1 1-\2/' \
X	< .newsrc.old > .newsrc
Xexit 0
________This_Is_The_END________
if test `wc -c < fixnewsrc` -ne 1296; then
	echo 'shar: fixnewsrc was damaged during transit (should have been 1296 bytes)'
fi
fi		; : end of overwriting check
exit 0