I need a small script (sh) to remove in a variable the filename extension.
Example:
f = "testfile.txt"
and I need a $a with "testfile".
Some one a idea?
f=testfile.txt ; a=`basename $f ".txt"` ;echo $a
Thanks
Using shell builtins (sh, bash and probably others too)
#!/bin/sh
a='testfile.test.txt'
echo "Filename: ${a%.*}"
echo "Extension: ${a##*.}"
exit 0
echo $FILENAME |sed 's/\(.*\)..../\1/'