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 diff
     1.1 --- a/graph3.sh	Sat Jun 09 00:12:14 2007 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,82 +0,0 @@
     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 -    
    1.52 -    sed -n -e ' 
    1.53 -      /^Profil/{
    1.54 -        s/Profil von: \(.\+\)/"\1";/
    1.55 -        w /tmp/aa
    1.56 -        s/;$//
    1.57 -        h
    1.58 -        #p
    1.59 -      }
    1.60 -
    1.61 -
    1.62 -      /^Nachricht/{
    1.63 -        G
    1.64 -        s/ - [-0-9]\+//
    1.65 -        s/Nachricht schreiben \(.\+\)\n/"\1" /
    1.66 -        s/"\(.\+\)" "\(.\+\)"/  "\2" -> "\1";/
    1.67 -
    1.68 -        # write out
    1.69 -        #p
    1.70 -        w /tmp/bb
    1.71 -      }
    1.72 -    ' $1
    1.73 -
    1.74 -    echo "digraph G {"
    1.75 -    grep -f /tmp/aa /tmp/bb
    1.76 -    echo "}"
    1.77 -
    1.78 -#    rm $file $file2
    1.79 -    exit 0
    1.80 -
    1.81 -  fi
    1.82 -else
    1.83 -    echo "usage: $0 <input.txt>"
    1.84 -    exit 1
    1.85 -fi
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/graph_sed.sh	Sat Jun 09 00:13:00 2007 +0200
     2.3 @@ -0,0 +1,82 @@
     2.4 +#!/bin/bash
     2.5 +# 
     2.6 +# Autor: markus schnalke (prog.marmaro.de)
     2.7 +# Autor: Julian Forster (www.ProgMaschine.de.vu)
     2.8 +#
     2.9 +
    2.10 +
    2.11 +if [ $# -eq 1 ]; then
    2.12 +  if [ $1 = '--version' ] ; then
    2.13 +    echo 'Buddylistgrapher (sed)'
    2.14 +    echo '======================'
    2.15 +    echo 'version 0.1'
    2.16 +    echo
    2.17 +    echo 'by Julian Forster (http://progmaschine.de.vu)'
    2.18 +    echo 'and Markus Schnalke (http://prog.marmaro.de)'
    2.19 +    exit 0
    2.20 +  elif [ $1 = '--help' ] ; then
    2.21 +    echo 'Buddylistgrapher (sed)'
    2.22 +    echo '======================'
    2.23 +    echo
    2.24 +    echo "usage: $0 <input.txt>"
    2.25 +    echo
    2.26 +    echo "The grapher generates output to stdout."
    2.27 +    echo "This output is the input for the graphviz tools."
    2.28 +    echo
    2.29 +    echo "You can use it like this:"
    2.30 +    echo "$0 input.txt | dot -Tpng > pic.png"
    2.31 +    echo
    2.32 +    echo "ToDo:"
    2.33 +    echo "The program was written for one specific kind of input data,"
    2.34 +    echo "so there is still some work to do to use it for general input."
    2.35 +    exit 0
    2.36 +  else
    2.37 +
    2.38 +    file=/tmp/`basename $0`-$$
    2.39 +    file2=/tmp/`basename $0`-$$-2
    2.40 +
    2.41 +#    # collect all profil names (we only want them as nodes)
    2.42 +#    cat $file | while read line ; do
    2.43 +#      echo -n "`echo $line | grep "Profil von:" | awk '{print " " $3 " "}'`" >> $file2
    2.44 +#    done
    2.45 +#    echo >> $file2
    2.46 +
    2.47 +
    2.48 +# TODO: fetch only edges for people having a profile
    2.49 +
    2.50 +    # output
    2.51 +    
    2.52 +    sed -n -e ' 
    2.53 +      /^Profil/{
    2.54 +        s/Profil von: \(.\+\)/"\1";/
    2.55 +        w /tmp/aa
    2.56 +        s/;$//
    2.57 +        h
    2.58 +        #p
    2.59 +      }
    2.60 +
    2.61 +
    2.62 +      /^Nachricht/{
    2.63 +        G
    2.64 +        s/ - [-0-9]\+//
    2.65 +        s/Nachricht schreiben \(.\+\)\n/"\1" /
    2.66 +        s/"\(.\+\)" "\(.\+\)"/  "\2" -> "\1";/
    2.67 +
    2.68 +        # write out
    2.69 +        #p
    2.70 +        w /tmp/bb
    2.71 +      }
    2.72 +    ' $1
    2.73 +
    2.74 +    echo "digraph G {"
    2.75 +    grep -f /tmp/aa /tmp/bb
    2.76 +    echo "}"
    2.77 +
    2.78 +#    rm $file $file2
    2.79 +    exit 0
    2.80 +
    2.81 +  fi
    2.82 +else
    2.83 +    echo "usage: $0 <input.txt>"
    2.84 +    exit 1
    2.85 +fi