Mercurial > buddylistgrapher
changeset 9:79af6ba23e46
rename
author | meillo@marmaro.de |
---|---|
date | Sat, 09 Jun 2007 00:13:00 +0200 |
parents | 98401a6717fc |
children | 9a85a9924834 |
files | graph3.sh graph_sed.sh |
diffstat | 2 files changed, 82 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/graph3.sh Sat Jun 09 00:12:14 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -#!/bin/bash -# -# Autor: markus schnalke (prog.marmaro.de) -# Autor: Julian Forster (www.ProgMaschine.de.vu) -# - - -if [ $# -eq 1 ]; then - if [ $1 = '--version' ] ; then - echo 'Buddylistgrapher (sed)' - echo '======================' - echo 'version 0.1' - echo - echo 'by Julian Forster (http://progmaschine.de.vu)' - echo 'and Markus Schnalke (http://prog.marmaro.de)' - exit 0 - elif [ $1 = '--help' ] ; then - echo 'Buddylistgrapher (sed)' - echo '======================' - echo - echo "usage: $0 <input.txt>" - echo - echo "The grapher generates output to stdout." - echo "This output is the input for the graphviz tools." - echo - echo "You can use it like this:" - echo "$0 input.txt | dot -Tpng > pic.png" - echo - echo "ToDo:" - echo "The program was written for one specific kind of input data," - echo "so there is still some work to do to use it for general input." - exit 0 - else - - file=/tmp/`basename $0`-$$ - file2=/tmp/`basename $0`-$$-2 - -# # collect all profil names (we only want them as nodes) -# cat $file | while read line ; do -# echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2 -# done -# echo >> $file2 - - -# TODO: fetch only edges for people having a profile - - # output - - sed -n -e ' - /^Profil/{ - s/Profil von: \(.\+\)/"\1";/ - w /tmp/aa - s/;$// - h - #p - } - - - /^Nachricht/{ - G - s/ - [-0-9]\+// - s/Nachricht schreiben \(.\+\)\n/"\1" / - s/"\(.\+\)" "\(.\+\)"/ "\2" -> "\1";/ - - # write out - #p - w /tmp/bb - } - ' $1 - - echo "digraph G {" - grep -f /tmp/aa /tmp/bb - echo "}" - -# rm $file $file2 - exit 0 - - fi -else - echo "usage: $0 <input.txt>" - exit 1 -fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graph_sed.sh Sat Jun 09 00:13:00 2007 +0200 @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Autor: markus schnalke (prog.marmaro.de) +# Autor: Julian Forster (www.ProgMaschine.de.vu) +# + + +if [ $# -eq 1 ]; then + if [ $1 = '--version' ] ; then + echo 'Buddylistgrapher (sed)' + echo '======================' + echo 'version 0.1' + echo + echo 'by Julian Forster (http://progmaschine.de.vu)' + echo 'and Markus Schnalke (http://prog.marmaro.de)' + exit 0 + elif [ $1 = '--help' ] ; then + echo 'Buddylistgrapher (sed)' + echo '======================' + echo + echo "usage: $0 <input.txt>" + echo + echo "The grapher generates output to stdout." + echo "This output is the input for the graphviz tools." + echo + echo "You can use it like this:" + echo "$0 input.txt | dot -Tpng > pic.png" + echo + echo "ToDo:" + echo "The program was written for one specific kind of input data," + echo "so there is still some work to do to use it for general input." + exit 0 + else + + file=/tmp/`basename $0`-$$ + file2=/tmp/`basename $0`-$$-2 + +# # collect all profil names (we only want them as nodes) +# cat $file | while read line ; do +# echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2 +# done +# echo >> $file2 + + +# TODO: fetch only edges for people having a profile + + # output + + sed -n -e ' + /^Profil/{ + s/Profil von: \(.\+\)/"\1";/ + w /tmp/aa + s/;$// + h + #p + } + + + /^Nachricht/{ + G + s/ - [-0-9]\+// + s/Nachricht schreiben \(.\+\)\n/"\1" / + s/"\(.\+\)" "\(.\+\)"/ "\2" -> "\1";/ + + # write out + #p + w /tmp/bb + } + ' $1 + + echo "digraph G {" + grep -f /tmp/aa /tmp/bb + echo "}" + +# rm $file $file2 + exit 0 + + fi +else + echo "usage: $0 <input.txt>" + exit 1 +fi