Mercurial > buddylistgrapher
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graph.sh Mon May 28 17:41:28 2007 +0200 @@ -0,0 +1,31 @@ +#!/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