I'm asking this as a new question because people didn't seem to understand my original question.
I can figure out how to find if a word starts with a capital and is followed by 9 letters with the code:
echo "word" | grep -Eo '^[A-Z][[:alpha:]]{8}'
So that's part 1 of what I'm supposed to do. My actual script is supposed to loop through each word in a text file that is given as the first and only argument, then check if any of those words start with a capital and are 9 letters long.
I've tried:
cat textfile | grep -Eo '^[A-Z][[:alpha:]]{8}'
and
while read p
do echo $p | grep -Eo '^[A-Z][[:alpha:]]{8}'
done < $1
to no avail.
Although:
cat randomtext.txt
outputs:
The loud Brown Cow jumped over the White Moon. November October tesTer Abcdefgh Abcdefgha
so it's correctly outputting all the words in the file randomtext.txt
then why wouldn't
cat randomtext.txt | grep -Eo '^[A-Z][[:alpha:]]{8}'
work?
cat | grepis useless, see partmaps.org/era/unix/award.html#cat (grepcan access files directly)