🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #203154

Re: How to access a post by Message-ID

#203154
From: »Q«
Date: Sun, 05 Aug 2007 02:02
62 lines
3485 bytes
In <news:slrnfb8lfe.usu.stefano.sabatini@santefisi.caos.org>,
Stefano Sabatini <stefano.sabatini@caos.org> wrote:

>permits to do it, but I would like to do it automatically, e.g. with a
>script which takes the message id and assemblate an
>address corresponding to the Google Gorups/other archive page.

I just had to write a script to generate a list of links from a text
file containing MID headers, so I'll use your post as an excuse to post
it.

This doesn't help you directly, but I guess parts of it could be used
in a script that slrn could pipe articles or just headers to.  The grep
and sed parts are the important bits.

It's intended to work on .mbox or other files with multiple MID
headers, but it would work on single posts ok.  Output is a list of
links.  Piping output to xargs firefox or xargs konqueror opens the
links in tabs (depending on the browser's settings, I guess).  Opera
needs some extra option I can't recall, but opera --help would turn it
up.

Please pardon the clumsy use of a conditional to deliver a usage
message.  My bash script fu isn't so strong.

#!/bin/bash
#
# This script takes as input a text file containing
# Message-ID headers, such as a .mbx file.  Only
# Message-ID headers lines are considered;  any
# other lines will be ignored.
#
# The output is a list of Google Groups URLs, one for
# each Message-ID from the input file.  If no output
# file is specified, the URLs will be printed to
# stdout.
#
# Note:  There's no error checking, other than to
# check that the input file exists.  And it clobbers
# the output file.  Pass bad parameters to this script 
# at your own risk.

if [ -f "$1" ]
 then
  INPUT=$1
  if [ -n "$2" ]
   then OUTPUT="$2"
   else OUTPUT="/dev/stdout"
  fi
  grep "^Message-ID: <.*>$" $INPUT | \
  sed "s/Message-ID: </http:\/\/groups.google.com\/groups?as_umsgid=/" | \
  tr -d ">" > "$OUTPUT"
 else
  echo "A script to turn Message-ID headers into Google Groups URLs."
  echo "The inputfile should be a file containing some Message-ID headers."
  echo
  echo "Usage:  $0 <inputfile> [<outputfile>]"
  echo
fi

-- 
»Q«
Technical Details
Message-ID: <omnfo4-nbq.ln1@goldry.remarqs.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <slrnfb8lfe.usu.stefano.sabatini@santefisi.caos.org>

Show Full Headers
Complete Article Headers
Message-ID: <omnfo4-nbq.ln1@goldry.remarqs.net>
Subject: Re: How to access a post by Message-ID
Date: Sat, 4 Aug 2007 21:02:32 -0500
From: »Q« <boxcars@gmx.net>
References: <slrnfb8lfe.usu.stefano.sabatini@santefisi.caos.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Organization: none
Lines: 62
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: individual.net dsv5WytMXPLvBBOPVXB30Q77+JSQOs/KyP+Xk7ZqUMfLWbzc14
X-Orig-Path: goldry.remarqs.net!news
Cancel-Lock: sha1:tvI1eNnhbRMVr7AsWtGwAdzjd98=
X-Newsreader: Claws Mail 2.9.2 (GTK+ 2.10.13; i686-pc-linux-gnu)
X-Face: *#`F(_&o, GRH~~$V&ByU1LZAWc]JgxuT`Pv2y0`&JE`(=*PcC>#m2]xv]p,
 i|9mDJ+8dGMJl`V[!z]\N}qrLTHjU]Sew>rQBShT_8.(0Q(iH,
 Gu7k|y/)^!@oVydVrix*#|-|u2~zgA'U3nQ_fa#jXvcGL[9f:>8?U=hXYK3D~*}Gq$TjPe1WXEFLGTiB3ot!oMH"'(Jop0(\0C
X-No-Archive: yes