I have a text file that contains following
https://git.centos.org/git/rpms/abc.git
https://git.centos.org/git/rpms/abc.git/
https://git.centos.org/git/rpms/abc
When I run the following command,
reponame=$(echo $url | awk -F/ '{print $NF}' | sed -e 's/.git\/$//' | sed -e 's/.git//')
echo $reponame
I am supposed to get
abc
It fails for the lines ending in .git/
but it works for the other 2 cases.