Quote:
Originally Posted by springjer10
I would like to write a scipt that takes a given date as as argument and prints to screen a number of events listed for that day.
For example I have a database of events (.txt file) that are of the form "12/12/12 :Jane's Birthday". I would like to write a script that takes the input "12/12/12" and returns the output "Jane's Birthday". I understand how to write a script that prints the entire database of dates and events but I do not know how to selectively print an event for a given date. Would anyone have any examples I could follow? Many thanks.
|
Try
grep. For example,
Code:
grep "^12/12/12" file.txt
will print all lines from
file.txt that begin with the string
"12/12/12"