Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Having random output from a file



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



Messages sorted by: Reverse Date, Date, Thread, Author