I'm trying to use a regexp using sed
. I've tested my regex with kiki, a gnome application to test regexpd, and it works in kiki.
date: 2010-10-29 14:46:33 -0200; author: 00000000000; state: Exp; lines: +5 -2; commitid: bvEcb00aPyqal6Uu;
I want to replace author: 00000000000;
with nothing. So, I created the regexp, that works when I test it in kiki:
author:\s[0-9]{11};
But doesn't work when I test it in sed
.
sed -i "s/author:\s[0-9]{11};//g" /tmp/test_regex.txt
I know regex have different implementations, and this could be the issue. My question is: how do I at least try do "debug" what's happening with sed? Why is it not working?
That looks more like a perl regex than it does a sed regex. Perhaps you would prefer using
At least that way you could always add
-Mre=debug
to debug the regex.In sed you need to escape the curly braces.
"s/author:\s[0-9]\{11\};//g"
should work.Sed has no debug capability. To test you simplify at the command line iteratively until you get something to work and then build back up.
command line input:
command line output: