Created
April 10, 2022 13:17
-
-
Save PetarKirov/0c4ea2808dcda152345d24405e708345 to your computer and use it in GitHub Desktop.
Parsing git remote project names and paths
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
while IFS="" read -r line; do | |
project_path=$(echo "$line" | sed -E 's"(git@|.+://)[^:/]+[:/](.+)/.+$"\2"') | |
repo_name=$(echo "$line" | sed -E -e 's|.+/(.+)$|\1|' -e 's|(.+)(.git)$|\1|') | |
echo "* '$line'" | |
echo " * '$project_path'" | |
echo " * '$repo_name'" | |
echo | |
done < ./example_urls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment