[ale] Bash question
ChangingLINKS.com
x3 at ChangingLINKS.com
Thu Sep 5 10:20:51 EDT 2002
Put email at ChangingLINKS.com on the list please . . . . : )
On Thursday 05 September 2002 11:06, Fletch wrote:
> >>>>> "esoteric" == esoteric <Geoffrey> writes:
>
> esoteric> Understanding that this was originally a bash question,
> esoteric> I'd suggest Perl is really the proper tool. I'm just
> esoteric> waiting for Fletch to chime in here... :)
>
>
> Well, if you're going to twist my arm . . .
>
>
> perl -e '$/="=*\n";while(<>){rand($.)<1&&do{chomp;$l=$_}}print$l' data
>
>
> That presumes that the "=*\n" delimiter follows items (yours
> basically had it preceding it, so you get an empty first record).
> It's basically the same format as fortune data files (which use "%\n"
> instead; see man strfile, man fortune; replacing "=*\n" with "%\n"
> gives you a poor man's fortune replacement). As for an explanation
> what it's doing, see perldoc -q 'random line'.
>
>
> Not that I in any way condone automatically sending people
> jokes via email. Come on, it's not the late 1980s any more. :)
--
Wishing you Happiness, Joy and Laughter,
Drew
http://www.ChangingLINKS.com
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list