This is a training task for the grep utility. There is a datebook file with this format:
James Ikeda:834-938-8376:23445 Aster Ave., Allentown, NJ 83745:12/1/38:45000 Jesse Neal:408-233-8971:45 Rose Terrace, San Francisco, CA 92303:2/3/36:25000 Jose Santiago:385-898-8357:38 Fife Way, Abilene, TX 39673:1/5/58:95600
You need to use the grep utility to display certain lines.
- Print all lines containing the Sun string:
grep 'Sun' datebook - Print all lines where people’s names begin with J: grep '^ J' datebook
- Print all lines ending with 700: grep '700 $' datebook
- Print all lines that do not contain 834 ???
- Print all lines, happy birthday in December: grep '/ 12 /' datebook
- Print all lines with phone numbers starting with 408: grep '438-' datebook
- Print all lines containing the following sequence of characters: capital letter, four lower case letters, comma, space and one capital letter: grep '[AZ] [az] {4}, [AZ]' datebook
- Print all the lines in which the last name starts with K or k: grep '^. [Az] [Kk]' datebook *
- Print all lines with their sequence numbers, where the last numeric field of the record consists of six digits ???
- Print all lines containing the words Lincoln or lincoln ???
Tell me how you can implement items 4, 9, 10. And how optimally are the others done?