From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29678 invoked by alias); 30 Sep 2012 16:17:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17301 Received: (qmail 1447 invoked from network); 30 Sep 2012 16:17:12 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120930091651.ZM26459@torch.brasslantern.com> Date: Sun, 30 Sep 2012 09:16:51 -0700 In-reply-to: <20120930122740.GA11056@solfire> Comments: In reply to meino.cramer@gmx.de "Somehow smoking a pipe twice...?" (Sep 30, 2:27pm) References: <20120930122740.GA11056@solfire> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Somehow smoking a pipe twice...? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 30, 2:27pm, meino.cramer@gmx.de wrote: } } My first command runs inside my mailfolder and looks like this } } ls -l `grep -l kolkrabe *` } } which give me a list of all files which contains the word "Kolkrabe" } ("Kolkrabe" is german for "common raven". Latin "Corvus corax"). } } But additionally I want to know the contents of the line, which } matches the grep command added to the end of the line "ls -l" } shows for each file. Keith has it at least partly right here. You need to let grep print both the file name and the line contents. At that point though, if you want the "ls" output as well, you'll have to capture the grep output and substitute in the "ls" output. You can do this with something like: temp==(grep kolkrabe *) eval \ 'paste =(ls -l $(cut -d : -f 1 $temp)) =(cut -d : -f 2 $temp)' But the only zsh-ish thing about that is the use of =(...) to manage the temporary files for you. "paste" also takes a -d option if you want something other than a tab character between the ls output and the grep output.