I can't find a way to delete everything after a character on the first occurrence.
first case: blahh123-blah-456 one two three
second case: 123-blah two 23 three
must be converted to
blah-456 one two three
blah two 23 three
so far I came up with the following regex, it only works for the first case but it doesn't work for the second one. I need sed to be able to remove all the characters before and including first sign "-"
echo "blahh123-blah-456 one two three" | sed 's/\(.*\)-\(.*-\)/\1foo39820\2/' | sed 's/^.*foo39820//'
Please point me to the right directions. Thanks in advance