Chapter 3: Advanced Command-Line Concepts
Activity 8: Word Matching with Regular Expressions
The commands to be used to answer the questions can be found here:
- The following command can be used to find the number of words that are five letters in length, begin with a consonant, and contain alternating vowels and consonants:
grep -c -E '^([^aeiou][aeiou]){2}[^aeiou]$' <words.txt 506
- Use the following command to find the number of words that are two or more characters long, begin with a consonant, and contain alternating consonants and vowels:
grep -c -E '^([^aeiou][aeiou])+[^aeiou]?$' <words.txt 2339
- Use the following command to count the three-letter words that start and end with the same letter:
grep -c -E '^(.).\1$' <words.txt 23
- The following command can be used to find the number of words that have the same vowel repeating twice consecutively in it:
grep -c -E '([aeiou])\1' <words.txt 1097
- The following...