view graph.sh @ 0:21d9547ef242

initial commit C++ and sh editions work similar
author meillo@marmaro.de
date Mon, 28 May 2007 17:41:28 +0200
parents
children
line wrap: on
line source

#!/bin/bash
# 
# Autor: Julian Forster
# www.ProgMaschine.de.vu
#
#

if [ $# -eq 1 ]; then
    file=/tmp/`basename $0`-$$
    grep -e "Profil von:" -e "Nachricht schreiben" $1 > $file

    echo "digraph G {"
    cat $file | while read line ; do
        isProfil=`echo $line | grep "Profil von:"`
        if [ -n "$isProfil" ] ; then
            name=$(echo $line |  awk '{ print $3 }')
            
        else
            buddy=$(echo $line |  awk '{ print $3 }')
            echo "\"$name\" -> \"$buddy\";"
            
        fi    
    done

    echo "}"

    exit 0
else
    echo ""
    exit 1
fi