You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
misc/shell_scripts/wiki_oldest_mentions

22 lines
693 B

#! /usr/bin/env bash
# http://fabien.benetou.fr/MemoryRecalls/ImprovingPIM
# TODO
# discard multiple edits on the same page
# put the number of results as a parameter (or just let the user do so?)
# cache the result as it should not change over time (except if pages are moved)
if [ $# -lt 1 ]
then
echo "Locating the first 10 edits of a word for PmWiki"
echo "usage: $0 word [PmWiki/wiki.d/path]"
echo "if the second parameter is omitted the path is assumed to be ."
exit
fi
WORD=$1
DEST=$2
NUMBEROFRESULT=10
# if $2 is empty, use the last part of the URI
if [ $# -lt 2 ]
then
DEST=.
fi
grep -i $WORD $DEST/* | sed "s/=.*//" | grep diff | sort -n -t: -k3 -r | tail -$NUMBEROFRESULT