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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/graph.sh Mon May 28 17:41:28 2007 +0200 1.3 @@ -0,0 +1,31 @@ 1.4 +#!/bin/bash 1.5 +# 1.6 +# Autor: Julian Forster 1.7 +# www.ProgMaschine.de.vu 1.8 +# 1.9 +# 1.10 + 1.11 +if [ $# -eq 1 ]; then 1.12 + file=/tmp/`basename $0`-$$ 1.13 + grep -e "Profil von:" -e "Nachricht schreiben" $1 > $file 1.14 + 1.15 + echo "digraph G {" 1.16 + cat $file | while read line ; do 1.17 + isProfil=`echo $line | grep "Profil von:"` 1.18 + if [ -n "$isProfil" ] ; then 1.19 + name=$(echo $line | awk '{ print $3 }') 1.20 + 1.21 + else 1.22 + buddy=$(echo $line | awk '{ print $3 }') 1.23 + echo "\"$name\" -> \"$buddy\";" 1.24 + 1.25 + fi 1.26 + done 1.27 + 1.28 + echo "}" 1.29 + 1.30 + exit 0 1.31 +else 1.32 + echo "" 1.33 + exit 1 1.34 +fi