I wrote this dirt stupid script to build a searchable index for our
help files. The idea would be that it would be run at compile time to
allow runtime keyword searches.
Any reason y'all see why it couldn't actually be refined to the point
of being useful (it's really just a toy) and be used in gnucash?
b.g.
#! /bin/bash
rm -f /tmp/tmpindex /tmp/tmpkeys
# match word occurrences to files
for i in "$@" ;
do
cat $i | sed -e "s/<[^>]*>//g"| tr \",\(\)\;\&\<\>\!\$\* ' ' |
tr -s ' ' '\n' | tr -d [:blank:] |
tr [:upper:] [:lower:] | sed -e "s/^..$//g" | sed -e "s/^.$//g" |
grep -E "^.+$" | sed -e 's/\. *$//g' | sed -e 's/: *$//g' |
sed -e s/^\'//g | sed -e s/\'$//g |
sed -e s/\$/\ $i/g | sort | uniq >> /tmp/tmpindex
done
# extract the keys
cat /tmp/tmpindex | sed -e "s/^\([^ ]*\) .*$/\1/" | sort | uniq > /tmp/tmpkeys
# build the index
echo "building db..."
rm -f p/tmpdb
for i in `cat /tmp/tmpkeys`;
do
list=`grep -E ^$i /tmp/tmpindex | sed -e "s/^[^ ]* \(.*\)$/\1/" |
uniq `;
echo $i: $list >> /tmp/tmpdb ;
done
_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel