0

I have some strings

some-string
some-other-string
yet-another-string-to-handle

I want to convert those strings into

someString
someOtherString
yetAnotherStringToHandle

I'm trying to do the following

echo yet-another-string-to-handle | sed -r 's/\-(.*)/\U\1\E/g'

But that results in

yetANOTHER-STRING-TO-HANDLE

Needless to say, I'm a bit lost. Any suggestions on how I can achieve my goal?

user672009
  • 4,379
  • 8
  • 44
  • 77

1 Answers1

3

With GNU sed:

sed -E 's/-(.)/\u\1/g' file

\u: Turn the next character to uppercase (GNU 'sed' extension).

Output:

someString
someOtherString
yetAnotherStringToHandle

See: info sed

Cyrus
  • 84,225
  • 14
  • 89
  • 153