linux - grep for only uppercase words -
i find words all uppercase, when do
grep -op '\w*[a-z]+\w*' *
i get
words.py:stringvalue words.py:words words.py:words_answered words.py:answered words.py:true
where hoping for
words.py:words words.py:words_answered
question
how can make sure uppercase words outputted?
you can use regex word boundary on either side , using [a-z0-9_]
instead of \w
:
grep -h -op '\b[a-z0-9_]*[a-z]+[a-z0-9_]*\b' * words.py:words words.py:words_answered
Comments
Post a Comment