In case of renaming multiple file extensions to another, they suggested to type this command in cmd promt or powershell: ren *.(current extension name) *.(new extension name)
But what about to renaming multiple file extensions to nil or no file extension? How to replace this command *.(new extension name) ?


newfile=$(echo $file|sed ‘s/..*//‘)
That’s a bit dangerous for a few reasons:
catis the wrong command, because it outputs the file’s content, not the file’s name.my.awesome.file.txtwould become an empty string, leading to errors. (The regex is not anchored to the end of the string ($), the.is not escaped, so it becomes a wild card, …)My awesome file.txtwould trip up the loop and lead to unwanted results.I’d suggest this:
for file in * ; do mv “$file” $(echo “$file” | sed -r 's/(\.tar)?\.[^.]*$//') ; doneWow, cat and sed, double unnecessary and extra wrong.