Regular expressions

I need to pick a part of string lets stay started with specific character and end with specific character to replace using sed command
the line is like this:

my audio book 71-skhdfon1dufgjhgf8.wav'

I want to move the characters beginning with - end before.
I have different files with random names so I need to automate it using sed or similar, any clue ? Thanks.

May I infer that the period right after "before" is NOT the sentence termintor but the "end ... specific character"? I too guess that it should not be eliminated but preserved - for the "extension". Try

sed 's/-[^.]*\././'

Add input to taste...

sed 's/-[^.]*//'
1 Like