From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10931 invoked by alias); 23 Oct 2013 18:46:53 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31875 Received: (qmail 19660 invoked from network); 23 Oct 2013 18:46:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 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== MIME-Version: 1.0 X-Received: by 10.182.55.38 with SMTP id o6mr3251585obp.26.1382553994665; Wed, 23 Oct 2013 11:46:34 -0700 (PDT) Date: Wed, 23 Oct 2013 14:46:34 -0400 Message-ID: Subject: tee stdin and grep without creating a temp file From: Cary Lewis To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=089e0158a882bc291f04e96ceff8 --089e0158a882bc291f04e96ceff8 Content-Type: text/plain; charset=ISO-8859-1 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? --089e0158a882bc291f04e96ceff8--