Issue
I tried something like this
sed 's/^[ \t]*//' file.txt | grep "^[A-Z].* "
but it will show only the lines that start with words starting with an uppercase.
file.txt content:
Something1 something2
word1 Word2
this is lower
The output will be Something1 something2 but I will like for it to also show the second line because also has a word that starts with an uppercase letter.
Solution
With GNU grep grep -P "[A-Z]+\w*" file.txt
will work. Or, as @Shawn said in the comment below, grep -P '\b[A-Z]' file.txt
will also work. If you only want the words, and not the entire line, grep -Po "[A-Z]+\w*" file.txt
will give you the individual words.
Answered By - jared_mamrot