Reputation: 3125
I want to delete lines in a file with 3 or more consecutive upper case characters.
Input:
ABBOTT FLORIST MIAMI BEACH
Abbott Lake Loop
Abbott Philip DDS
Output:
Abbot Lake Loop
I tried sed 's/[A-Z]{3}/g' infile
but does not give me desired results. Any help?
Upvotes: 0
Views: 386
Reputation: 10039
sed -n '/[A-Z]\{3,\}/ p' infile
print only line with at least 3 upper letter together
your sed (sed 's/[A-Z]{3}/g' infile
) is a partial sed action
{3}
litteraly, missing the escape \
before {
s/selectpattern/resultpattern/option
Upvotes: 0
Reputation: 77105
Here is another alternate using awk
:
$ awk '/[A-Z]{3,}/{next}1' file
Abbott Lake Loop
Upvotes: 2
Reputation: 16994
One way using GNU sed:
sed -r '/[A-Z]{3,}/d' file
grep can also be used :
grep -vE "[A-Z]{3,}" file
Upvotes: 3