I commonly build up long, multi-command pipes on Linux/Unix to process large text files (sed | grep | sort | less , etc.).
I would like to be able to use a pipeline element that would buffer everything received via stdin until a key phrase/string is detected (e.g. "SUCCESS"), at which point it releases everything received up to that point to stdout and then continues to pass the rest of the stream through. If the key phrase is not detected, the program would discard all the contents.
Is there a standard command that can do this, or do I need to write a Perl script?
Thanks in advance for any ideas here!
Wodow, lover of pipes