Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!image.soe.clarkson.edu!news From: nelson@sun.soe.clarkson.edu (Russ Nelson) Newsgroups: comp.binaries.ibm.pc.d Subject: Re: Automated extraction of programs from c.b.i.p postings. Message-ID: Date: 19 Jul 90 04:01:23 GMT References: <5213@castle.ed.ac.uk> Sender: news@sun.soe.clarkson.edu Reply-To: nelson@clutx.clarkson.edu (aka CLUTX.BITNET) Organization: Clarkson University, Potsdam NY Lines: 86 In-reply-to: elee24@castle.ed.ac.uk's message of 18 Jul 90 14:12:40 GMT I changed this a little because I don't have brik, plus I tried to make it check the checksum of the file using zoo, but I don't have the right filename or something... Also, I keep a copy of the first article up to the begin line, and I add that to the article by hand (although it would be better to do it automatically). Anyway, if someone gets that to work, I'd appreciate a copy. -russ #!/bin/sh # $(#) pibm -- save c.b.i.p. articles -- Andre van Dalen, andre@targon # Save postings from comp.binaries.ibm.pc # tmp=/tmp/pibm$$ cd /usr/local/News/ibm cat - > $tmp #if brik -cv < $tmp #then # echo Checksum OK.. #else # echo Checksum NOT OK!!! File not saved! # exit 1 #fi #subject=`grep '^Subject:' $tmp` #part=`echo $subject | sed -n 's:^.*[Pp]art \([0-9][0-9]*\)/.*$:\1:p'` #last=`echo $subject | sed -n 's:^.*[Pp]art [0-9][0-9]*/\([0-9][0-9]*\).*$:\1:p'` #name=`echo $subject | sed 's/Subject: v[^:]*: \([^, ]*\)[, ].*/\1/'` archnam=`grep '^Archive-name:' $tmp` subject=`grep '^Subject:' $tmp` part=`echo $subject | sed -n 's:^.*[Pp]art *\([0-9][0-9]*\)/.*$:\1:p'` last=`echo $subject | sed -n 's:^.*[Pp]art *[0-9][0-9]*/\([0-9][0-9]*\).*$:\1:p'` name=`echo $archnam | sed -e 's/Archive-name: \([^, ]*\).*/\1/' \ -e 's:/[Pp]art[0-9][0-9]*::' | tr '/' '_' ` txtname=`echo $archnam | sed -e 's/Archive-name: //' -e 's/\(\/\).*$//'` save=ibm/$name.$part lastsave=ibm/$name.$last #echo name $name part $part last $last save $save lastsave $lastsave #exit if [ "$part" = "" ] then echo One part posting, uudecoding... cd ibm cat $tmp | sed '/^BEGIN/,$d' > $txtname.hdr /usr/local/public/bin/uudec < $tmp chmod 664 $txtname.zoo else echo Multi part posting, saving as $save if [ -f $save ] then echo $save already exists! not saved. else cp $tmp $save nr=`ls ibm/$name.[0-9][0-9] | wc -l` echo Now we have $nr out of $last parts if [ -f $lastsave -a $nr -eq $last ] then echo Last part, try to combine... cd ibm cat $name.01 | sed '/^BEGIN/,$d' > $txtname.hdr list=`echo " " $name.* " " | sed 's/ [^ ]*[^0-9 ] / /g'` echo "$list -> " \\c # brik -cv $list cat $list | sed '/^END--/,/^BEGIN--/d' | /usr/local/public/bin/uudec echo $name*.[aze]* chmod 664 $txtname.zoo echo mv $name.[0-9][0-9] old mv $name.[0-9][0-9] old fi fi fi rm $tmp -- --russ (nelson@clutx [.bitnet | .clarkson.edu]) Russ.Nelson@$315.268.6667 In Communism's central planning, citizens are told "you will make widgets". In Capitalism's advertising, citizens are told "you will buy widgets".