A complete script showing the logic you want to implement would help, especially if it contained representative sample data.
Instead of running grep and a script every 20 minutes, why not perform the grep processing in the script. For bonus points the script could remember (using an external file) where it got up to last time and search from that point forward. That avoids the need to remove duplicate lines and internalizing the grep keeps all the business logic in one place.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond