I'd like to extract the extension out of a filename with multiple dots. For instance:
gbamidi-v1.0.tar.gz
I should get "tar.gz", not "gz" or "0.tar.gz".
I prefer a solution not relying on bash exclusive features (using posix commands like sed
or cut
is ok).
EDIT: A reasonable solution could be: "get everything after the second-last dot, but exclude numbers or substrings with a lenght <=1"
...0
,...1
, etc.)? – muru Jan 27 '15 at 21:00.h
,.a
, etc., but in this case they won't occur. – eadmaster Jan 27 '15 at 21:33