I have the following pattern on a few thousand lines I will like to use regex to convert to what I want
RewriteRule ^/omg/deadly-venom/?$ http://www.example.com/omg/deadly-venom [L,NC,R=301]
RewriteRule ^/buzz/get-on-it/?$ http://www.example.com/buzz/get-on-it/ [L,NC,R=301]
and others like this for a few thousand lines
So basically I want to have this
RewriteRule ^/omg/(deadly-venom)/?$ http://www.example.com/omg/$1 [L,NC,R=301]
RewriteRule ^/buzz/(get-on-it)/?$ http://www.example.com/buzz/$1 [L,NC,R=301]
How do I achieve this? I use the sublime text editor but can also use sed or awk in terminal.
UPDATED: the last /
should not result in double slash before the $1
like this //$1
instead it should still be /$1
just look at the before and after from above and see lines with ending /
and the one without