Re: Inserting fields by reading and comparing two files? -->
by Ed Morton <morton@[EMAIL PROTECTED]
>
Mar 20, 2008 at 05:30 PM
On 3/20/2008 5:23 PM, google@[EMAIL PROTECTED]
wrote:
> Hey AWK Folks!
> I'm stumped... Here's what I'm trying to do. I have two files,
> 1) names.out with three fields space delimited. User Login ID,
> Firstname, & Lastname IE:
> jjd John Doe
> jdd Jane Doe
> sae Someone Else
> ... etc ...
> 2) masterfile.out with 3 fields colon delimited. User Login
> ID:null:department number IE:
> jjd:null:43
> jdd:null:25
> sae:null:9
> ... etc ...
>
> What I need to do is fill all the null's in masterfile.out with first
> and last name found in my names.out file.
awk 'NR==FNR{a[$1]=$2" "$3;next}{$2=a[$1]}1' names.out FS=":" OFS=":"
masterfile.out
Ed.