Searching files

Assigned: 10/15
Due: 10/22

Create a shell script to display the appropriate Unix command and the result of the command for each of the following: (use /usr/dict/words)
Set a variable w to the dictionary(/usr/dict/words)

  1. Display the number of words that begin with ap
  2. Display all the words that begin with quin
  3. Display all the words that end with rky
  4. Display all the words in the dictionary that start with an uppercase letter and end with ky
  5. Display a count of all the words that contain any uppercase letter
  6. Display a count of all of the words that contain an q or Q
  7. Give another command to answer the previous question (number 6)
  8. Display the number of words that do not begin with ap
  9. Display a count of the words that don't contain a vowel regardless of case
  10. Define a variable v that contains aeiou
  11. Display all the words that start with a vowel (defined in question 10) and end with ky
  12. Define a variable c that contains the 21 lower case consonants
  13. Display the count of the number of words that contain 5 lower case consonants in a row
  14. Display as accurate of a count as possible of the number of times that you have used grep (hint: use the history command)
  15. Display all the words that contain 3 consonants, followed by two vowels, followed by 3 consonants
  16. Display all the words that contain three of the same letter pairs
  17. Display a count of the words that begin and end with the same letter

For each answer, the script is to first echo the command and then run the command. For example:
echo "w=/usr/dict/words"
w=/usr/dict/words

After your SHELL script is completed, run the script command and then run your SHELL script.