annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
1 #!/bin/bash
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
2 #
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
3 # Autor: Julian Forster
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
4 # www.ProgMaschine.de.vu
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
5 #
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
6 #
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
7
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
8 if [ $# -eq 1 ]; then
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
9 file=/tmp/`basename $0`-$$
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
10 grep -e "Profil von:" -e "Nachricht schreiben" $1 > $file
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
11
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
12 echo "digraph G {"
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
13 cat $file | while read line ; do
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
14 isProfil=`echo $line | grep "Profil von:"`
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
15 if [ -n "$isProfil" ] ; then
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
16 name=$(echo $line | awk '{ print $3 }')
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
17
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
18 else
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
19 buddy=$(echo $line | awk '{ print $3 }')
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
20 echo "\"$name\" -> \"$buddy\";"
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
21
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
22 fi
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
23 done
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
24
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
25 echo "}"
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
26
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
27 exit 0
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
28 else
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
29 echo ""
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
30 exit 1
21d9547ef242 initial commit
meillo@marmaro.de
parents:
diff changeset
31 fi