I’m working on some stuff related to converting files, and I’m trying to find a shell command to remove the original file extension.
For example, if I convert a file called text.rtf, it will be converted into text.rtf.mobi. I’d like to use something to remove the .rtf (or any other extension) so it’s only text.mobi.
I’ve been playing with awk and sed but I couldn’t get anything to work. I’m not sure how to get it to pick up both the original extension and the .mobi, but only remove the original extension.
Somewhat related, where should I be going to pick up regex and actually understand it instead of just immense amounts of Googling? Thanks.
EDIT: I was a little unclear in the original post so let me clarify. The shell command I need is for removing the original extension in a converted file, such as text.ANYTHING.mobi. Sorry about the confusion.
1 Answer