From owner-freebsd-questions@FreeBSD.ORG Sat Feb 4 16:13:48 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 477F716A420 for ; Sat, 4 Feb 2006 16:13:48 +0000 (GMT) (envelope-from adamnealis@yahoo.co.uk) Received: from smtp018.mail.yahoo.com (smtp018.mail.yahoo.com [216.136.174.115]) by mx1.FreeBSD.org (Postfix) with SMTP id C52AF4464A for ; Sat, 4 Feb 2006 16:13:47 +0000 (GMT) (envelope-from adamnealis@yahoo.co.uk) Received: (qmail 45463 invoked from network); 4 Feb 2006 16:13:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:Message-ID:Date:From:Reply-To:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=yF0CpSy0DktZlaqA938lMdNMe+HUWtJliM37oW3q8u11T7SFZz2EhOFThJZTbxIf1+860wcfdJKOV3LcLTJUBRtR5LkoIprOqDhRLPopsqvue1gxIQaonVWs99aUM/xRt1XcD66wBk1k3+cEKh80MirPt/zbHANHm+0jpAaBJHk= ; Received: from unknown (HELO ?192.168.0.2?) (adamnealis@84.13.68.39 with plain) by smtp018.mail.yahoo.com with SMTP; 4 Feb 2006 16:13:46 -0000 Message-ID: <43E4D2B6.50509@yahoo.co.uk> Date: Sat, 04 Feb 2006 16:13:42 +0000 From: Adam Nealis User-Agent: Mozilla Thunderbird 1.0.7 (X11/20060114) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kristian Vaaf References: <7.0.1.0.2.20060203110425.01744328@broadpark.no> In-Reply-To: <7.0.1.0.2.20060203110425.01744328@broadpark.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: Script to generate names X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: adamnealis@yahoo.co.uk List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2006 16:13:48 -0000 Kristian Vaaf wrote: > > Hello. > > I'm looking for pointers on how to make a simple shell script that will > generate new names based on words (one word per line) from two different > files, and output these to a third file. > > This would be nice to come up with new cool names, > either for business or pleasure. > > The first file will be a list of custom words. > The second file will be /usr/local/share/dict/words. > > If the first word in the custom list is "apathy" and the first word in the > dictionary file is "alien", it will generate: > > apathyalien > alienapathy > > To a third file. And then continue with the rest of the words ... > > A friend told me I could do something like this: > > for i in $(> list 3 That's going to ba a large file of mixed words! Would be faster in perl than in the shell. Put the below in a file, and run it like this: perl myfile.pl > myListOfMixedWords #!/usr/bin/perl use warnings; use strict; my @custw; my @dictw; my $cw; my $dw; my $i; open F1, "web2.head-100"; open F2, "web2.tail-100"; while ( chomp ( $custw[$i++] = ) ) { } $i=0; while ( chomp ( $dictw[$i++] = ) ) { } foreach $cw ( @custw ) { foreach $dw ( @dictw ) { print "$cw$dw\n"; print "$dw$cw\n"; } } > > Do you all think the same? > > Thank you so much, > Kristian > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" > ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com