grep command for uppercase
i wrote a command
Code:
grep '^[[:upper:]]' file1 i got lines starting with capital letter but after that it may or maynot contain capital letters contents of my file1 are Code:
HELLO HELLO Hello HEllo HOW But its not what i am expecting i want only output as HELLO HOW |
Your regular expression matches a single character at the beginning of each line. Instead, you need to match any number of upper-case characters till the end of the line (add the $ anchor):
Code:
grep '^[[:upper:]]*$' file1 Code:
grep -E '^[[:upper:]]+$' file1 |
All times are GMT -5. The time now is 11:53 PM. |