I have several kinds of strings like this:
the example string1
--AbbbAnde---
the example string2
abksjiRNNBBKUGFLYFYLF
the example string3
-ankNUGUYUBUIGCafrg--
the example string4
BNKJUGFVULNK-Kew---
PS: there are no strings having zero or one capital letter.
I want to find indexes of the first and the last capital letter from the string which looks like the above examples by awk, sed, or other bash programs, because I have thousands of files, and Python would be time-consuming. the index of the first capital letter should be the count from the start to the end (left to the right). while the index of the last capital letter should be the count for the end to the start (right to the left).
for example,
for the example string1, the first capital letter is A, and the index is 3 from the left to the right (start to end). the last capital letter is A, and the index is 7 from the end to the beginning.
for the example string2, the first capital letter is R, and the index is 7 from the left to the right (start to end). the last capital letter is F, and the index is 1 from the end to the beginning.
for the example string3, the first capital letter is N, and the index is 5 from the left to the right (start to end). the last capital letter is C, and the index is 7 from the end to the beginning.
for the example string4, the first capital letter is B, and the index is 1 from the left to the right (start to end). the last capital letter is K, and the index is 6 from the end to the beginning.
Thanks for your help.