Background: I am moving some sql statements from SQL server to Oracle. While Oracle is case sensitive in string comparison, SQL server is not, by default I think. In my case all strings have to be in upper case.
in the original I might have something like
xyz like '%foo%' and ...
which I want to convert to
xyz like '%FOO%' and ...
i.e. anything between quotes following 'like ' has to be capitalised.
here is what I have tried and does not work:
echo "like 'aaa' aaa"|sed 's/like\( '.*'\)/like\U\1/g'
for some reason this gives me
like 'AAA' AAA
I don't understand why it matches the whole line, even after the second quote.
This does also not work:
echo "like 'aaa' aaa"|sed 's/like\( '[^']*\)/like\U\1/g'
why? I don't understand the error message sed: -e expression #1, char 26: unterminated 's' command
Any ideas? Thanks a lot!