Script to generate names
parv at pair.com
Fri Feb 3 12:14:19 PST 2006
in message <184.108.40.206.2.20060203110425.01744328 at broadpark.no>,
wrote Kristian Vaaf thusly...
> 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.
> 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:
> To a third file. And then continue with the rest of the words ...
> A friend told me I could do something like this:
( reformatted for loop)
> for i in $(<list1) $(<list2)
That will generate, first, all the words from list1, then from
list2, in a sequence. You may also get "too many args" or some such
error message if list are sufficiently huge.
BTW, process substitution -- $( <file ) construct -- does not work
w/ /bin/sh of FreeBSD 6, but does w/ bash 3 or zsh 4. So, when you
(general "you") post a shell question, please also mention the
intended shell being used.
> do echo -n $i
> done \
That will put all the words, from both list, in one long line,
on standard out.
> && echo >> list 3
At the end of the loop, you put a new lines in file "list" , not
"list3" (which i assume is only a typo). Mind you nothing else
(namely the for loop output) goes in list3.
I do not have a solution yet, will post later if nobody else posts
(a working) one.
More information about the freebsd-questions