buddylistgrapher
annotate graph3.sh @ 8:98401a6717fc
updated performance.txt
author | meillo@marmaro.de |
---|---|
date | Sat, 09 Jun 2007 00:12:14 +0200 |
parents | b82703cc3dd4 |
children |
rev | line source |
---|---|
meillo@4 | 1 #!/bin/bash |
meillo@4 | 2 # |
meillo@4 | 3 # Autor: markus schnalke (prog.marmaro.de) |
meillo@4 | 4 # Autor: Julian Forster (www.ProgMaschine.de.vu) |
meillo@4 | 5 # |
meillo@4 | 6 |
meillo@4 | 7 |
meillo@4 | 8 if [ $# -eq 1 ]; then |
meillo@4 | 9 if [ $1 = '--version' ] ; then |
meillo@4 | 10 echo 'Buddylistgrapher (sed)' |
meillo@4 | 11 echo '======================' |
meillo@4 | 12 echo 'version 0.1' |
meillo@4 | 13 echo |
meillo@4 | 14 echo 'by Julian Forster (http://progmaschine.de.vu)' |
meillo@4 | 15 echo 'and Markus Schnalke (http://prog.marmaro.de)' |
meillo@4 | 16 exit 0 |
meillo@4 | 17 elif [ $1 = '--help' ] ; then |
meillo@4 | 18 echo 'Buddylistgrapher (sed)' |
meillo@4 | 19 echo '======================' |
meillo@4 | 20 echo |
meillo@4 | 21 echo "usage: $0 <input.txt>" |
meillo@4 | 22 echo |
meillo@4 | 23 echo "The grapher generates output to stdout." |
meillo@4 | 24 echo "This output is the input for the graphviz tools." |
meillo@4 | 25 echo |
meillo@4 | 26 echo "You can use it like this:" |
meillo@4 | 27 echo "$0 input.txt | dot -Tpng > pic.png" |
meillo@4 | 28 echo |
meillo@4 | 29 echo "ToDo:" |
meillo@4 | 30 echo "The program was written for one specific kind of input data," |
meillo@4 | 31 echo "so there is still some work to do to use it for general input." |
meillo@4 | 32 exit 0 |
meillo@4 | 33 else |
meillo@4 | 34 |
meillo@4 | 35 file=/tmp/`basename $0`-$$ |
meillo@4 | 36 file2=/tmp/`basename $0`-$$-2 |
meillo@4 | 37 |
meillo@4 | 38 # # collect all profil names (we only want them as nodes) |
meillo@4 | 39 # cat $file | while read line ; do |
meillo@4 | 40 # echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2 |
meillo@4 | 41 # done |
meillo@4 | 42 # echo >> $file2 |
meillo@4 | 43 |
meillo@4 | 44 |
meillo@4 | 45 # TODO: fetch only edges for people having a profile |
meillo@4 | 46 |
meillo@4 | 47 # output |
meillo@4 | 48 |
meillo@4 | 49 sed -n -e ' |
meillo@4 | 50 /^Profil/{ |
meillo@6 | 51 s/Profil von: \(.\+\)/"\1";/ |
meillo@6 | 52 w /tmp/aa |
meillo@6 | 53 s/;$// |
meillo@4 | 54 h |
meillo@4 | 55 #p |
meillo@4 | 56 } |
meillo@4 | 57 |
meillo@4 | 58 |
meillo@4 | 59 /^Nachricht/{ |
meillo@4 | 60 G |
meillo@4 | 61 s/ - [-0-9]\+// |
meillo@4 | 62 s/Nachricht schreiben \(.\+\)\n/"\1" / |
meillo@4 | 63 s/"\(.\+\)" "\(.\+\)"/ "\2" -> "\1";/ |
meillo@4 | 64 |
meillo@4 | 65 # write out |
meillo@6 | 66 #p |
meillo@6 | 67 w /tmp/bb |
meillo@4 | 68 } |
meillo@4 | 69 ' $1 |
meillo@4 | 70 |
meillo@6 | 71 echo "digraph G {" |
meillo@6 | 72 grep -f /tmp/aa /tmp/bb |
meillo@4 | 73 echo "}" |
meillo@4 | 74 |
meillo@4 | 75 # rm $file $file2 |
meillo@4 | 76 exit 0 |
meillo@4 | 77 |
meillo@4 | 78 fi |
meillo@4 | 79 else |
meillo@4 | 80 echo "usage: $0 <input.txt>" |
meillo@4 | 81 exit 1 |
meillo@4 | 82 fi |