I want to add $x/ from data formatted as $x-xyz (xyz is a mix of text and number to be ignored).
Example data
AB-10C
CD-02E
Output
AB/AB-10C
CD/CD-02E
How do I describe the variable as text before the hyphen? My idea is:
define $x = # dunno how to do that
## and then somehow use sed to prepend
sed -i s/$/$x/ file
# I don't know if sed can handle variables though - the above one liner is from Googling
Please advise.