Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
tee stdin and grep without creating a temp file
- X-seq: zsh-workers 31875
- From: Cary Lewis <cary.lewis@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: tee stdin and grep without creating a temp file
- Date: Wed, 23 Oct 2013 14:46:34 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Di1nedTwv2IJOCnyMGxq20EYYjliIcnjIRabcX2zC4A=; b=L5mNiAz+nwSpSYD7VpPjwP52zspp76GqGuGSNXwtLBXcMuvn2wXzlw3NsfevdJuw/b I4yoK5My0vl/3e3qC10MACkSsqVZ3fMKHQu6YqsSgMRd/8HQwj2Kmsj+4uep5HVPFetZ OgWag39MYGAtqaNaHQrbn00MD9cB/1wzriaItn456jKXrGtRS+dX2jj0eb1q6ZTvmvRf zY5MI8iNCrWNtazaI3lLcrGko/Vokf1oBHuCsr8iYU17K+MkEuh4ZOYVVEB5vV+kRqyx D3iL5hHPzbCqZ3hF6SNa83wGC2bmcdqn0Q6TFFlJRNjVadDzLQc/CHsMJrb9c6Ku4d6J +YOw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author