The first command strips down the full path filename to the filename only ising the basename command.
Afterwards you can see how to extract the file extension from the filename. There is no need to do this after issuing the above command since this command will just remove everything after the first from right dot (‘.’) — so make sure that the filename you are parsing has a dot or you will end up with wrong results (like the full path or a part of the full path if it contains a dot somewhere).
Finally, by issuing the following command you remove everything after the first dot on the right (including).
This post is also available in: Αγγλικα