I want to get the filename (without extension) and the extension separately.
The best solution I found so far is:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
This is bad because it doesn't work if the filename contains multiple "." characters. If let's say I have a.b.js it will consider a and b.js, instead of a.b and js.
It can be easily done in Python with
file, ext = os.path.splitext(path)
but I'd prefer not to fire a Python interpreter just for this, if possible.
Any better ideas?