buddylistgrapher
diff graph3.sh @ 4:b82703cc3dd4
added sed edition but still incomplete
author | meillo@marmaro.de |
---|---|
date | Mon, 28 May 2007 23:09:06 +0200 |
parents | |
children | e34b27b544b5 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/graph3.sh Mon May 28 23:09:06 2007 +0200 1.3 @@ -0,0 +1,79 @@ 1.4 +#!/bin/bash 1.5 +# 1.6 +# Autor: markus schnalke (prog.marmaro.de) 1.7 +# Autor: Julian Forster (www.ProgMaschine.de.vu) 1.8 +# 1.9 + 1.10 + 1.11 +if [ $# -eq 1 ]; then 1.12 + if [ $1 = '--version' ] ; then 1.13 + echo 'Buddylistgrapher (sed)' 1.14 + echo '======================' 1.15 + echo 'version 0.1' 1.16 + echo 1.17 + echo 'by Julian Forster (http://progmaschine.de.vu)' 1.18 + echo 'and Markus Schnalke (http://prog.marmaro.de)' 1.19 + exit 0 1.20 + elif [ $1 = '--help' ] ; then 1.21 + echo 'Buddylistgrapher (sed)' 1.22 + echo '======================' 1.23 + echo 1.24 + echo "usage: $0 <input.txt>" 1.25 + echo 1.26 + echo "The grapher generates output to stdout." 1.27 + echo "This output is the input for the graphviz tools." 1.28 + echo 1.29 + echo "You can use it like this:" 1.30 + echo "$0 input.txt | dot -Tpng > pic.png" 1.31 + echo 1.32 + echo "ToDo:" 1.33 + echo "The program was written for one specific kind of input data," 1.34 + echo "so there is still some work to do to use it for general input." 1.35 + exit 0 1.36 + else 1.37 + 1.38 + file=/tmp/`basename $0`-$$ 1.39 + file2=/tmp/`basename $0`-$$-2 1.40 + 1.41 +# # collect all profil names (we only want them as nodes) 1.42 +# cat $file | while read line ; do 1.43 +# echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2 1.44 +# done 1.45 +# echo >> $file2 1.46 + 1.47 + 1.48 +# TODO: fetch only edges for people having a profile 1.49 + 1.50 + # output 1.51 + echo "digraph G {" 1.52 + 1.53 + sed -n -e ' 1.54 + /^Profil/{ 1.55 + s/Profil von: \(.\+\)/"\1"/ 1.56 + h 1.57 + #p 1.58 + } 1.59 + 1.60 + 1.61 + /^Nachricht/{ 1.62 + G 1.63 + s/ - [-0-9]\+// 1.64 + s/Nachricht schreiben \(.\+\)\n/"\1" / 1.65 + s/"\(.\+\)" "\(.\+\)"/ "\2" -> "\1";/ 1.66 + 1.67 + # write out 1.68 + p 1.69 + } 1.70 + ' $1 1.71 + 1.72 + 1.73 + echo "}" 1.74 + 1.75 +# rm $file $file2 1.76 + exit 0 1.77 + 1.78 + fi 1.79 +else 1.80 + echo "usage: $0 <input.txt>" 1.81 + exit 1 1.82 +fi