summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/Reaktor/sed-plugin.py
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-12-08 18:26:08 +0100
committermakefu <github@syntax-fehler.de>2015-12-08 18:26:08 +0100
commit869a278aa8bdaf981222a4e72a4cfc3fbb740f95 (patch)
tree1d6894d690e08f31e0de2a8f193fe3f8b57af275 /makefu/2configs/Reaktor/sed-plugin.py
parent3a9cbcdcd749138168ee41d1f010bbf206a11667 (diff)
m 2 Reaktor: use sed-plugin
Diffstat (limited to 'makefu/2configs/Reaktor/sed-plugin.py')
-rw-r--r--makefu/2configs/Reaktor/sed-plugin.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/makefu/2configs/Reaktor/sed-plugin.py b/makefu/2configs/Reaktor/sed-plugin.py
index 6d6e1f8b8..677a1a44f 100644
--- a/makefu/2configs/Reaktor/sed-plugin.py
+++ b/makefu/2configs/Reaktor/sed-plugin.py
@@ -21,8 +21,8 @@ m = is_regex(line)
if m:
f,t,flagstr = m.groups()
- f = f.replace('\/','/')
- t = t.replace('\/','/')
+ fn = f.replace('\/','/')
+ tn = t.replace('\/','/')
flags = 0
count = 1
if flagstr:
@@ -30,10 +30,20 @@ if m:
flags = re.IGNORECASE
if 'g' in flagstr:
count = 0
+ else:
+ flagstr = ''
last = d.get(environ['_from'],None)
if last:
- print(f,t,last)
- print(re.sub(f,t,last,count=count,flags=flags))
+ print(fn,tn,last)
+ #print(re.sub(fn,tn,last,count=count,flags=flags))
+ from subprocess import Popen,PIPE
+ p = Popen(['sed','s/{}/{}/{}'.format(f,t,flagstr)],stdin=PIPE,stdout=PIPE )
+ so,_ = p.communicate(last+"\n")
+ if p.returncode:
+ print("something went wrong when trying to process your regex")
+ print(so)
+
+
else:
print("no last message")
else: