In a ksh shell script, I need to split a filename into two components : the name and the extension.
Apart from the simple case, this should be able to handle situations like: files with no extension; files where the dot appears for more than once. Examples:
filename.ext file_name="filename" file_ext=".ext"
filename file-name="filename" file_ext=""
filename.my.file.ext file_name="filename.my.file"
file_ext=".ext"
Could anyone supply some simple code to achive this?
Apart from the simple case, this should be able to handle situations like: files with no extension; files where the dot appears for more than once. Examples:
filename.ext file_name="filename" file_ext=".ext"
filename file-name="filename" file_ext=""
filename.my.file.ext file_name="filename.my.file"
file_ext=".ext"
Could anyone supply some simple code to achive this?