Nix: Extract file extension from file name
If you need to know in a *nix script the extension of a file, try the following:
$ filename="abc.txt"
$ file_ext="${filename##*\.}"
$ echo "${file_ext}"
txt
Via SO.
If you need to know in a *nix script the extension of a file, try the following:
$ filename="abc.txt"
$ file_ext="${filename##*\.}"
$ echo "${file_ext}"
txt
Via SO.
Leave a comment