TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

quick scripting question



        I'm feeling really stupid asking this, because I really *should*
know how to do this but...

I have a list of names in a file 
format: 
<firstname> <lastname>
<firstname> <lastname>
<firstname> <lastname>
etc..

I want to take each firstname & lastname pair, and search for them in
another file, counting the number of occurrences (using wc -l).

this is on a win32 machine, and I have the Cygwin awk & bash. (no perl).

how do i do it?

environment variables apparently won't take a multi-line list 
(otherwise I could do something like:
        for name in $namelist
        do
                echo $name >> outputlist.txt
                grep $name filename|wc -l >> outputlist.txt
        done
)

I've looked at awk; but I can't seem to figue out how to take a variable
read from one file, and apply it to an operation on another file.

yes, I know, this would be quite a bit easier if I had perl...

Carl Soderstrom
System Administrator    307 Brighton Ave. 
Minnesota DHIA	        Buffalo, MN	
carls@agritech.com      (763) 682-1091