I have several git-Repos in such format:
product.module1.git
product.module2.git
...
Now I just want to iterate over the list to get just
module1
module2
How can I achieve this? I've already tried ls in combination with grep, but I'm not able to remove the first and last string parts.
If your grep
supports the -P
option:
$ grep -oP '(?<=[.])\w+(?=[.])' file
module1
module2
(?<=[.])
is a look behind. It matches, in this case, just after a period.
\w+
matches any number of word characters.
(?=[.])
is a look ahead. It matches, in this case, just before a period.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With