Grep assignment
CSCI 330
Summer 1999
Updated 23 July 1999 18:25

Due Tuesday 27 July 1999 at close of labs.
E-Mail the file containing your grep statements to your TA and put a copy in the drop box.

Strings, words and filenames may be quoted to emphasize them in the problem. The quotes are not part of the string or filename unless you are told specifically told to handle them. The data files you will be searching are found in my /home/ux/berezin/data directory.

A space is the character generated by the space bar and has the ascii value 32. When looking for a space, you can use the space bar to generate the character.

A tab is the character generated by the tab key and has an ascii value 9

A carridge return has an ascii value 13 and can be generated by using <ctrl>v .ltctrl>m

White space refers to either a space or a tab.

A digit is a single character of numeric value between 0 and 9.

A number is a sequence of one or more digits.

An integer number contains no decimal or other seperators in the sequence of digits that compose it.

An alpha character is a character in the range of a-z or A-Z

An alpha-numeric character is a character in the range of a-z, A-Z or 0-9

Do not use options unless specifically requested.
Use grep on the file hp1 in my data directory to

1. Find all lines containing the string "mail"

2. Find all lines containing the string "mailto"

3. Find all lines containing the word "mailto"

4. Find all lines containing the word "mail"

5. Find all lines that begin with a "<"

6. Find all lines that do not begin with a "<"

7. Find all lines that are indented by one or more whitespace characters.

8. Find all lines that end with a ">"

9. Find all lines that do not end with a ">"

10. Find all lines that refer to the directory "/quizes"

11. Find all lines that contain a digit. The digit may be anywhere on the line and my be embedded in a random string of characters

12. Find all lines that contain an even number. - consisting of one or more digits with the last digit ending in an even value. Treat number like a word.

13. Find all lines that start with "<a" and end with "</a>"

14. Find all lines that have only unsigned integer numbers on them. Numbers may be seperated by white space. Line may have many different numbers but there will only be numbers but no other information.

15. Find all lines that are blank, line may have spaces or tabs

16. Find all lines that are blank but not empty, line must have one or more spaces or tabs

17. Find all lines that are empty, line has no spaces tabs or other data.

18. Find all lines that contain only one integer number, it may be signed and there may be white space padding before or after the number. There is one and only one number on the line and no other information.

19. Find all lines that contain the string <br>     b and r may be in either upper or lower case. Do NOT use the case option to find.

20. Find all lines that contain a string of alpha characters that is at least 7 characters long.

21. Find all lines that contain two strings of alpha characters that are 7 characters long. Strings must be seperated by any number (at least one) of non-alpha characters.

22. Find all lines that contain a word (alpha characters) repeated elsewhere on the line.

23. Find all lines that contain more than one word starting with the same alpha character.

24. Find all lines that contain a pair of characters repeated in repeated in reverse order as a pair elsewhere on the line.

25. Find all lines that contain no white space.