Hello,
from the gnu sed manual, I should be able to do this:
`\(REGEXP\)'
Groups the inner REGEXP as a whole, this is used to:
* Apply postfix operators, like \`\\\(abcd\\\)*': this will search
for zero or more whole sequences of \`abcd', while \`abcd*'
would search for \`abc' followed by zero or more occurrences
of \`d'. Note that support for \`\\\(abcd\\\)*' is required by
POSIX 1003.1-2001, but many non-GNU implementations do not
support it and hence it is not universally portable.
the version of sed I am using is gnu sed v 4.1.5
The feature mentioned above does not seem to be working; eg,
echo "abc-abc" | sed -r 's/[\(abc\)]/%/g'
gives:
%%%-%%%
If it were treating abc as grouped, I should get:
%-%
I have tried to get this feature to work on several different systems, and never have. I have done a fair amount of googling on this with no answers.
Ultimately what I would like to do is remove text between two strings, eg, <script and </script>, without being greedy. So I would like to be able to do something like:
sed 's/<script[^\(<\/script>\)]*<\/script>//g'
in order to only remove text between a <script string and the next </script> string without removing all the text clear to the last </script> string on the line.
An input on why this does not seem to be working for me would be greatly appreciated.
Allasso