I have a write grep problem that should grep only those lines that have a word consisting only of capital characters.
For example, I have a file: file1.txt
Abc AAA ADFSD F AAAAx
And the conclusion should be:
Abc AAA ADFSD F
Thanks for any advice.
This egrep should work:
egrep '\b[A-Z]+\b' file
You can simply use:
grep -E '\b[[:upper:]]+\b' file1.txt
That is, find whole words consisting of only capital letters.
grep -w '[^ ]*[A-Z]\+' file1.txt
, ASCII, \p{Lu} [A-Z]:
\p{Lu}
[A-Z]
grep -P '\b\p{Lu}+\b' file
LONDON Paris MÜNCHEN Berlin
LONDON MÜNCHEN Berlin
, , , , @Skippy-le-grand-gourou, egrep [A-Z] , \p{Lu}, " 2017 , , ẞ " "
grep -oP '\b[A-Z0-9_]+\b' file1.txt
, //_ (, HELLO, NUMBER10, RLIMIT_DATA).
HELLO
NUMBER10
RLIMIT_DATA
eDw.
eDw
GNU grep POSIX, :
grep -e '[[:upper:]]' file1.txt
grep '\ < [A-Z] * > ' file1.txt