The sed below will output the input accurately. What I would like to do is replace all occurrences of _ with - in the first matching group (\ 1), but not in the second. Is it possible?
echo 'abc_foo_bar=one_two_three' | sed 's/\([^=]*\)\(=.*\)/\1\2/' abc_foo_bar=one_two_three
So, the conclusion I hope for is:
abc-foo-bar=one_two_three
I would prefer not to resort to awk, since I also execute a number of other sed commands, but I will resort to this if necessary.
Edit: minor fix for RE
source share