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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -