zsh-workers
 help / color / mirror / code / Atom feed
* tee stdin and grep without creating a temp file
@ 2013-10-23 18:46 Cary Lewis
  2013-10-25  1:16 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Cary Lewis @ 2013-10-23 18:46 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

I have a situation where I need to grep an stdin input stream, and based on
whether I find a certain pattern, take appropriate action. The action
involves processing the stdin stream again.

I solved this by simply copying the stdin stream to a temporary file, and
then grepping the temp file, and then using the temp file later on in the
script.

But this is not very elegant. I tried to create a fifo with mkfifo, and tee
the stdin to the pipe and then grep on the output of the tee. This approach
doesn't work correctly.

Does anyone have an elegant way to do this?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-25  1:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-23 18:46 tee stdin and grep without creating a temp file Cary Lewis
2013-10-25  1:16 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).