#! /bin/bash # Copyright (C) 2006-2008 Lars Eggert # All rights reserved. # # Redistribution and use in source and binary forms are permitted # provided that the above copyright notice and this paragraph are # duplicated in all such forms and that any documentation, # advertising materials, and other materials related to such # distribution and use acknowledge that the software was developed # by the author. The name of the author may not be used to endorse # or promote products derived from this software without specific # prior written permission. # # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE. # $Id: find-replaced-by,v 1.11 2008/07/17 15:14:02 eggert Exp $ iddir=$HOME/Documents/Work/IETF/ids # make a list "AREA WG" of all current areas and wgs wgs=`mktemp` ietf-wgs > $wgs all=`mktemp` ls $iddir | sed -E -e "s/(.*)-[[:digit:]]+\..*/\1/" | sort | uniq > $all tagged=`mktemp` sed -E -e "s/draft-(.*)/\1/; s/^[^-]+-(.*)/\1/" $all | paste $all - > $tagged ietf=`mktemp` grep "^draft-ietf-" $tagged | sort -b -k 2 > $ietf indv=`mktemp` grep -v "^draft-ietf-" $tagged | sort -b -k 2 > $indv db=`mktemp` join -1 2 -2 2 -o "2.1 1.1" $ietf $indv > $db rm $all $tagged $ietf $indv out=`mktemp` while read line do indv=`echo $line | cut -d" " -f1` ietf=`echo $line | cut -d" " -f2` wget -q --no-check-certificate -O- \ "https://datatracker.ietf.org/drafts/$ietf/" | grep -Eo $indv > /dev/null if [ "$?" -ne "0" ]; then echo "$indv REPLACED BY $ietf" >> $out fi done < $db # output by area and wg for area in `cut -f1 -d" " $wgs | sort | uniq`; do echo ----------------------------------------------------------------- echo $area Area echo ----------------------------------------------------------------- for wg in `grep "^$area" $wgs | cut -f2 -d" "`; do list=`mktemp` grep -i "REPLACED BY draft-ietf-$wg-" $out > $list if [ "$?" -eq "0" ]; then echo $wg Working Group, $area Area lam -s " " $list echo fi rm $list done done rm $out $wgs # check for inconsistencies echo ----------------------------------------------------------------- echo Potential Inconsistencies echo ----------------------------------------------------------------- cut -f2 -d" " $db | sort | uniq -c | grep -v " *1" | sed -E -e 's/ */ /' -e 's/^ *//' \ -e 's/(.*) (.*)/\2 may replace one or more of \1 individual IDs - check this/' rm $db