Pull random line from a file

Kevan Shea biffcool at zombieworld.com
Thu Sep 5 20:31:17 PDT 2002


On Thu, 5 Sep 2002 20:57:58 -0600, Rob Park <rbpark at ualberta.ca> wrote:
> 
> This ought to do it:
> 
> rand($.) < 1 && ($line = $_) while <>;
> 
> ... OH, you wanted BASH? heh, oops ;)
> 

Thanks Larry ;)

-- 
Kevan Shea
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-chat' in the subject header of the message



More information about the lfs-chat mailing list