Why does the following command still return some lines containing a capital letter?
aspell dump master | grep ozz | grep -v '[^A-Z]'
grep -v '[^A-Z]'
-v) the lines that contain a character other than the characters A to Z.
You probably want:
grep -v '[[:upper:]]'
to remove the lines with at least one upper-case letter, or:
LC_ALL=C grep -v '[A-Z]'
to remove the lines with at least one of 26 ASCII characters between
To remove only lines beginning with a capital letter:
aspell dump master | grep ozz | grep -v '^[[:upper:]]'
First off, you are inverting an inversion, which isn't want you want. What you are looking for is more like this:
aspell dump master | grep ozz | grep '^[^A-Z]*$'
You are matching on individual characters. You need to match on more than just 1 (if you want to only select lines that don't have caps). So we add the asterisk (*) to the end. This means, I am looking for lines that have 0 or more non-capital letters. We add the caret (^) to the front and the dollar sign ($) to the end to denote, from the beginning of the line to the end of the line. So this can be read as, from the beginning of the line to the end of the line, 0 or more characters that don't contain any character from A-Z.