Re: Script to generate names



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 $(<list1) $(<list2) ; do echo -n $i ; done && echo >> 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++] = <F1> ) ) { }

$i=0;
while ( chomp ( $dictw[$i++] = <F2> ) ) { }

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@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"






___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: file rename help
    ... Why, BTW? ... a shell script is a shell script and a Perl program is... ... what if $cfile was empty and hence moved to "$cfile.zero.txt"?!? ...
    (comp.lang.perl.misc)
  • Re: Scripting question, [small programming question
    ... at "rpm -ql util-linux". ... > comprehensive language like perl. ... I think a good rule of thumb is that if your shell script doesn't fit on a ...
    (Fedora)
  • [OT] Re: simple question on C++
    ... Jerry Stuart wrote: ... >> have something like this working today, I'd probably use Perl. ... I am familiar with Linux and would ... Well, on a typical Solaris system a shell script would do, and no reboot ...
    (alt.comp.lang.learn.c-cpp)
  • [PATCH 2/3]: Remove perl from make headers_install
    ... Remove perl from make headers_install by replacing a perl script (doing ... a simple regex search and replace) with a smaller and faster shell script ... -# installdir: ...
    (Linux-Kernel)
  • RE: Run Shell Script Using Perl
    ... Run Shell Script Using Perl ... You need to rewrite a shell script that does file transfer in Perl? ... would work -- ftp, scp, rsync, cp over NFS mount (or SMB mount, or DAV ...
    (perl.beginners)