Q:

sed command to be used to modify the file name

I am able to use the sed command for a simple things but I have a question which for me is complex to find the solution by my own, so if some one can help me it would be a great favour.
example: how shall I modify the following file as following?
orig_file_name = OBIEE_S99_TT_PLV_BI0026.rpd
target_file_name = OBIEE_S99_TT_PLV.rpd

so in my bash script, I will be doing following.
1. check the latest file in a directory.
2. pickup that file and modify its name, similar as above.
situations: I do not know always what would be the file name is, but i know the part of pattern, file names always ends as "something_is_name_xxxx.rpd"
so then I would want to modify the file name as "something_is_name.rpd"

A:

I would do something like this, but i don't doubt there are better solutions.
for f in $(ls -1t OBIEE_S99_TT_PLV* | head -1)
do
    mv $f $(echo $f | sed 's/_BI[0-9]*//g')
done

