changeset 13:fe4ccf810364

some cleanups in sed-variant
author meillo@marmaro.de
date Sat, 09 Jun 2007 12:20:43 +0200 (2007-06-09)
parents 91f3e84482fa
children dbaa8a943271
files graph_sed.sh
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graph_sed.sh	Sat Jun 09 12:16:22 2007 +0200
+++ b/graph_sed.sh	Sat Jun 09 12:20:43 2007 +0200
@@ -35,11 +35,12 @@
     file=/tmp/`basename $0`-$$
     file2=/tmp/`basename $0`-$$-2
 
-    
-    sed -n -e ' 
+
+    # sed
+    sed -n -e " 
       /^Profil/{
-        s/Profil von: \(.\+\)/"\1";/
-        w /tmp/aa
+        s/Profil von: \(.\+\)/\"\1\";/
+        w $file
         s/;$//
         h
         #p
@@ -49,21 +50,22 @@
       /^Nachricht/{
         G
         s/ - [-0-9]\+//
-        s/Nachricht schreiben \(.\+\)\n/"\1" /
-        s/"\(.\+\)" "\(.\+\)"/  "\2" -> "\1";/
+        s/Nachricht schreiben \(.\+\)\n/\"\1\" /
+        s/\"\(.\+\)\" \"\(.\+\)\"/  \"\2\" -> \"\1\";/
 
         # write out
         #p
-        w /tmp/bb
+        w $file2
       }
-    ' $1
+    " $1
 
+    # output
     echo "digraph G {"
-    grep -f /tmp/aa /tmp/bb
+    grep -f $file $file2
     echo "}"
 
-#    rm $file $file2
-    rm /tmp/aa /tmp/bb
+    # cleanup
+    rm $file $file2
     exit 0
 
   fi