On bash, I'm trying to get the uppercase letter immediately after a whitespace (A
from File A.jpg
).
echo "Path/To/File A.jpg" | grep -oP '[A-Z](?!/s)'
This is a negative lookahead (?!
that should return any uppercase after a whitespace. So, it should return only A
. However, it's returning all upercases:
P
T
F
A
It seems it's treating forward slashes as whitespaces? Why? How can I get only the last A
?