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