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\'.\'
Simply use ${parameter%word}
${parameter%word}
In your case:
${FILE%.*}
If you want to test it, all following work, and just remove the extension:
FILE=abc.xyz; echo ${FILE%.*}; FILE=123.abc.xyz; echo ${FILE%.*}; FILE=abc; echo ${FILE%.*};