GREP Homework

Create a file with the raven poem. You can find the poem here.

Create a script with the grep commands to do the following: (In your script, first print (echo) a blank line and then the question and then echo a blank line and then run the grep comand. If you cannot get the correct result, print a comment explaining some of the commands you tried to get the correct result. Upload the script to moodle when you are done.

1. Use grep to show all the times Edgar Allen Poe's poem "The Raven" contains the word "raven". (All following questions refer to this same poem.)

_________________________________________________

2. Use grep or egrep to pick out the blank lines in the file: (find lines that start and end with nothing in between.)

__________________________________________________

3. Use grep or egrep to pick out lines with rep, word, or more. (use the alternator |)

__________________________________________________

4. Use grep or egrep to pick out lines that have at least two p's followed by any number of letters followed by 'ore'. The p's do not have to be next to each other. ( .* dot and then asterisk will find any characters in the search text)

__________________________________________________

5. Use grep or egrep to pick out all the lines with v, z or I in them: use the class brackets [ ] to solve this one

__________________________________________________

6. Use grep or egrep to pick out all the lines that do not start with an uppercase letter.

__________________________________________________

7. Use grep or egrep to pick out all the lines that end with a dash -

__________________________________________________

8. Use grep or egrep to pick out all the words that end with ore

__________________________________________________

9. Use grep or egrep to pick out all the words that start with f or F

__________________________________________________

10. Use grep or egrep to pick out lines that uses first letter alliteration - starting two words with the same letter. ( .* dot and then asterisk will find any characters in the search text)

__________________________________________________