I am working on a programming assignment where I have to search for an entry in a text file, and print out text corresponding to the entry. As an example, let's say I have an entry as follows,
JOHN DOE
34 RIGHT WAY
HALIFAX
465-0394
, and the user enters HALIFAX as the keyword, I then would want to find the line that Halifax is located on, and then print out all associated text with this entry. The tricky part is doing this all without grep, sed, or awk, as the assignment is not accepted if these commands are used. I thought about using regular expressions, but these text manipulations can only be done on a single line, and I must do it for the entire file. As of now I am stumped and any help would be appreciated!
Alex