diff --git a/index_news.sh b/index_news.sh index add61623..d0845989 100755 --- a/index_news.sh +++ b/index_news.sh @@ -28,15 +28,19 @@ for forum in $(find $Rep_News -type d -mindepth 1 -printf '%P \n') ; do if test -f $fichier ; then for article in $(find $Rep_News$forum -type f -maxdepth 1 -newer $fichier -printf '%P \n') ; do mid=$(grep "Message-ID: " $Rep_News$forum/$article | awk '{print $2}') - $(echo $article $mid >> $id ) + ref=$(grep -m 1 -A 9 "References: " $Rep_News$forum/$article | \ + awk 'BEGIN { RS = "" ; FS = ":" } {print $2}' | grep "^ <" | tr -d '\n') + $(echo $article $mid $ref >> $id ) done else # si le dernier message avant le dernier id-xage est annule ou modere - # ou si le fichier des mid n'existe pas : + # ou si le fichier des mid n'existe pas : # on est bourrin : on re-indexe l'ensemble $(echo -n > $id) for article in $(find $Rep_News$forum -type f -maxdepth 1 -printf '%P \n') ; do mid=$(grep "Message-ID: " $Rep_News$forum/$article | awk '{print $2}') - $(echo $article $mid >> $id ) + ref=$(grep -m 1 -A 9 "References: " $Rep_News$forum/$article | \ + awk 'BEGIN { RS = "" ; FS = ":" } {print $2}' | grep "^ <" | tr -d '\n') + $(echo $article $mid $ref >> $id ) done fi fi