Code:
while :
do
RT:^)M grep
sleep $TIME
done
where TIME varies from minutes to weeks depending on circumstances.
Seriously,
grep is one of the most useful text processing commands in the *nix CLI arsenal. Its options are numerous & powerful & it pays to refresh your memory of them periodically.
Same for
sed & even more so for
awk. With
awk check the
info system for the deep stuff. (Hint: Konqueror can display
info system pages as html -- put "##<command>" in its address bar.)
In the case or your Q, if you use
sed or
awk, you may not need
grep as both can operate only on lines matching a regex.