I want to remove the "LP2_" prefix and everything except the name, like the "09b11.sfs" from Aqualung, the "-1.0.1.sfs" from AutoAdjustPhoto, the "_2.1.sfs" from AsUnder and the "-2.8.6.sfs" from AbiWord.

Could this be done using a single command like sed?

If, how?

Or will the different endings:" -1.0.1.sfs" - "_2.1.sfs" - "09b11.sfs" cause problems?

The suffix, however, is difficult, because there is no way to know a certain word is part of the suffix to be erased, or it is part of the name you want to keep, so you'll have to use a marker that is unique to separate between the words you want to keep and the suffix you want to delete. It can the the last underscore (_), last minus (-), or whatever.

I will assume here that you've decided that all the suffix will be preceded by an underscore; that is, everything after the last underscore will be deleted.

I want to remove the "LP2_" prefix and everything except the name, like the "09b11.sfs" from Aqualung, the "-1.0.1.sfs" from AutoAdjustPhoto, the "_2.1.sfs" from AsUnder and the "-2.8.6.sfs" from AbiWord.

Could this be done using a single command like sed?

If, how?

Or will the different endings:" -1.0.1.sfs" - "_2.1.sfs" - "09b11.sfs" cause problems?