Re: Inserting fields by reading and comparing two files? -->
by Ed Morton <morton@[EMAIL PROTECTED]
>
Mar 20, 2008 at 09:39 PM
On 3/20/2008 8:17 PM, Gecko12332 wrote:
> Wow! Grant & Ed for the amazing help ( more like the answer:) ) on
> this! Worked like a charm! I did forget one thing which was some of
> these names had middle initials which were always single char followed
> by a period IE Jane S. Doe so I stripped any possible middle initials
> out by doing the following, though it took me forever to figure out:
> awk -F. '{gsub("\\.","");gsub(" . "," "); print $1}' names.out >
> names_no_middle_initial.out
You could just leave them in:
awk 'NR==FNR{n=$1;$1="";sub(/ +/,"");a[n]=$0;next} {$2=a[$1]}1' names.out
FS=":"
OFS=":" masterfile.out
Ed.