From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16481 invoked by alias); 3 Apr 2012 11:19:05 -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: 16970 Received: (qmail 1543 invoked from network); 3 Apr 2012 11:18:53 -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.0 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at mail.physik.hu-berlin.de does not designate permitted sender hosts) Date: Tue, 3 Apr 2012 12:23:05 +0200 From: Eike von Seggern To: zsh-users@zsh.org Subject: Re: Having random output from a file Message-ID: <20120403102304.GA12996@matzbach> Mail-Followup-To: zsh-users@zsh.org References: <20120402191933.5608a936@internecto.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120402191933.5608a936@internecto.net> User-Agent: Mutt/1.5.21 (2010-09-15) On Mon, Apr 02, 2012 at 19:19 +0200, Mark van Dijk wrote: > Hello, > > I have a file that contains quotes that are separated by a blank line. Can zsh > help me to randomly output a quote from that file or should I use awk, or grep > or so? Should the first quote be prefaced by a blank line? > > Thanks for helping me, > -Mark. I use this alias to get a random line from a file (so it would only work in your case if each quote is on a single line) alias rndline='sort -R | head -1' But it's not using any zsh magic. Best eike