Created
May 19, 2017 12:27
-
-
Save pierrefevrier/a349f13267c8f54e2bb71c8bd577770a to your computer and use it in GitHub Desktop.
Cut usefull samples
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
# =================================================================== | |
# EXTRACT PARTS OF A STRING | |
# =================================================================== | |
typeset -r STRING='1.0.0-just-a-test' | |
# GET THE FIRST PART ONLY (=1.0.0) | |
echo "$STRING" | cut -d '-' -f1 | |
# GET THE LAST PART ONLY (=just-a-test) | |
echo "$STRING" | cut -d '-' -f2- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment