Article View: news.software.readers
Article #453archeck -- Find your recently posted to newsgroups
From: Dan_Jacobson
Date: Mon, 05 Aug 1991 19:02
Date: Mon, 05 Aug 1991 19:02
156 lines
6006 bytes
6006 bytes
Wouldn't it be neat to remember where you've been posting recently?
How 'bout a shell script that would do this:
$ archeck 1
Mon Aug 5 13:14:00 CDT 1991
======5th====== newsgroups posted to on the 5th:
gnu.emacs.gnus
rec.arts.tv
rec.music.funky
[...etc. Here's the shell script:]
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: archeck
# Wrapped by danj1@ihburn on Mon Aug 5 13:50:53 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive."'
if test -f 'archeck' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'archeck'\"
else
echo shar: Extracting \"'archeck'\" \(3685 characters\)
sed "s/^X//" >'archeck' <<'END_OF_FILE'
X: use /bin/sh
X# Wouldn't it be neat to remember where you've been posting recently?
X# How 'bout a shell script that would do this:
X# $ archeck 2
X# Mon Aug 5 13:14:00 CDT 1991
X#
X# ======5th====== newsgroups posted to on the 5th:
X# gnu.emacs.gnus
X# rec.arts.tv
X# rec.music.funky
X#
X# ======4th====== newsgroups posted to on the 4th:
X# comp.emacs
X# comp.unix.programmer
X# gnu.emacs.help
X# misc.consumers
X# rec.autos.driving
X# rec.food.cooking
X# sci.geo.geology
X# sci.lang
X# sci.space
X#
X# @@@@@@@@@@@@@@@@ Summary @@@@@@@@@@@@@@@@
X# comp.emacs
X# comp.unix.programmer
X# gnu.emacs.gnus
X# gnu.emacs.help
X# misc.consumers
X# rec.arts.tv
X# rec.autos.driving
X# rec.food.cooking
X# rec.music.funky
X# sci.geo.geology
X# sci.lang
X# sci.space
X#
X# (Then you could do)
X# $ archeck 2 | mail your_boss your_professor etc.
X# (just joking. Anyway, here's the (rest of the) shell script:)
X
X#Find your recently posted to newsgroups. Optional $1 is how many
X#days to search backward, default 21. Cannot go back more than a
X#month. Assumes you save your posted articles in a different file
X#every day. I save mine in, e.g., $HOME/.mail/#postedSun4Aug [adjust
X#"$file" below]. Written by Dan_Jacobson@ATT.COM 8/1991, who isn't
X#really planning on doing bug fixes, enhancements, etc. Seems pretty
X#portable.
X
X#set -e
Xlimit=${1-21} #articles expire her 14 days, but some one might have
X#replied to something posted a week earlier... so should check 21 days...
Xset `date`; today=$3
Xecho $@ #date, because I often print it out on paper for later analysis
Xi=0
Xwhile test $i -lt $limit
Xdo
X #no big deal that this month may have less than 31 days
X search_date=`expr \( \( 30 + $today - $i \) % 31 \) + 1` #1..31
X #never negative internally for older expr's
X
X case $search_date in #make correct English suffix
X 1|21|31) suffix=st;;
X 2|22) suffix=nd;;
X 3|231) suffix=rd;;
X *) suffix=th;;
X esac
X echo
X echo ======${search_date}${suffix}====== \
X newsgroups posted to on the ${search_date}${suffix}:
X file=$HOME/.mail/#posted???${search_date}??[a-z] #...you might
X #customize this. [This is within 14 characters filename
X #limits for those systems where it's a problem.]
X test -f $file &&
X todays=`grep '^Newsgroups: ' $file |
X sed 's/.*Newsgroups: //'|
X tr ',' '\012'| #portable between SYS V & BSD
X sort -u`
X echo "$todays"
X all="${all+$all
X}$todays"
X i=`expr $i + 1`
Xdone
Xecho
Xecho @@@@@@@@@@@@@@@@ Summary @@@@@@@@@@@@@@@@
Xecho "$all"|sort -u
X
X#Oh, How would one save their posted articles in a different file
X#every day? well in my .emacs file for GNUS I do:
X
X#(setq
X# news-reply-mode-hook
X# (function
X# (lambda ()
X#
X# (setq
X# gnus-author-copy
X# ;;from gnuspost.el
X# (let ((date (current-time-string)))
X# (if
X# (string-match
X# "^[^ ]+ \\([^ ]+\\)[ ]+\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) [0-9][0-9]\\([0-9][0-9]\\)"
X# date)
X# (concat ;"/usr/tmp/" (user-login-name)
X# vm-folder-directory "#posted"
X# (substring date 0 3) ;day of week
X# (substring date (match-beginning 2) (match-end 2)) ;Day
X#;;; (substring date (match-beginning 6) (match-end 6)) ;Year
X# (substring date (match-beginning 1) (match-end 1)) ;Month
X#;;; (substring date (match-beginning 3) (match-end 3)) ;Hour
X#;;; (substring date (match-beginning 4) (match-end 4)) ;Minute
X#;;; (substring date (match-beginning 5) (match-end 5)) ;Second
X# )
X# (error "Cannot understand current-time-string: %s." date))
X# )))))
X
X#I suppose you rn users could create an environment variable in your
X#.profile/.login files for exporting a daily save file into rn.
X#After a few weeks I have a cron job clean out the older save files.
END_OF_FILE
if test 3685 -ne `wc -c <'archeck'`; then
echo shar: \"'archeck'\" unpacked with wrong size!
fi
chmod +x 'archeck'
# end of 'archeck'
fi
echo shar: End of archive.
exit 0
Technical Details
Message-ID:
<1991Aug5Mo150150.Dan_Jacobson@ATT.COM>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!funic!fuug!mcsun!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsj!cbnewsi!cbnewsh!cbnewse!danj1Show Full Headers
Complete Article Headers
Message-ID: <1991Aug5Mo150150.Dan_Jacobson@ATT.COM> Subject: archeck -- Find your recently posted to newsgroups Date: Mon, 05 Aug 1991 19:02:39 +0000 From: Dan_Jacobson@ATT.COM Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!funic!fuug!mcsun!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsj!cbnewsi!cbnewsh!cbnewse!danj1 Newsgroups: gnu.emacs.gnus,news.software.readers,gnu.emacs.sources,alt.sources Sender: danj1@cbnewse.cb.att.com (daniel.jacobson) Followup-To: gnu.emacs.gnus,news.software.readers,alt.sources.d Organization: AT&T-BL, Naperville IL, USA Lines: 155