Created
April 6, 2015 14:44
-
-
Save numberwhun/87a42c309ca014d1a0c0 to your computer and use it in GitHub Desktop.
Getting parts of a filename in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~% FILE="example.tar.gz" | |
~% echo "${FILE%%.*}" | |
example | |
~% echo "${FILE%.*}" | |
example.tar | |
~% echo "${FILE#*.}" | |
tar.gz | |
~% echo "${FILE##*.}" | |
gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment