How to copy Content of a file to another file on a specific column

Hi i have a file (file1)with this content:

1.2.3.10.in-addr.arpa

and a second file (file2) with a content wich have 8 Columns

if a do a

awk '{print $8}' file2

i become this output:

,'10.3.2.1.',

So i want to replace only the 10.3.2.1. in file2 (column 8) with the information off file1 (1.2.3.10.in-addr.arpa)

so the result is ,'1.2.3.10.in-addr.arpa',

Can anybody telme what i have to do? Maybe with awk

Do the files only have one entry or is this just an example? If there are more than one, is the only way to determine the replacement the reversed IP? Can you post a representative sample (more than one line) of what you have and what you want?

something like this:

$more file2
colum1 colum2 colum3 colum4 colum5 colum6 colum7 colum8 colum9
$awk '{$8="1.2.3.10.in-addr.arpa"; print $0 }' file2
colum1 colum2 colum3 colum4 colum5 colum6 colum7 1.2.3.10.in-addr.arpa colum9

Hi, thank you for the reply.

The file2 contains commands for mysql (generated with a converting tool):

And file1 has only one column:

Both files have 255 lines.

What i need is the file2 like this:

insert into records (domain_id, name,type,content,ttl,prio) select id ,'1.2.3.10.in-addr.arpa', 'PTR', 'nameofserver.', 172800, 0 from domains where name='in-addr.arpa';
insert into records (domain_id, name,type,content,ttl,prio) select id ,'2.2.3.10.in-addr.arpa', 'PTR', 'nameofserver.', 172800, 0 from domains where name='in-addr.arpa';
.
.
.

You need to read de file1?
I see that the unic modification is de one of then number in IP i think that is this the pattern and the file1 is in order 1,2,3,4,5 you don't need to read all the registrys of this file you only need the IP range.

awk 'BEGIN {conta=1} {$8=conta".2.3.10.in-addr.arpa"; conta++;print $0 }' file12

Hi Thank you for the reply.

You are right. Its Enough to do it how do describe.

If i do it how you describe i became this in file12:

Thats cool. I am convinced to learn awk in the furure. Now i have to be see how i can insert the ,' bevor and ', behind the reverse IP Adress. Because mysql need it. So that i have a output like this:

Any ideas?

awk '{$8="," q "1.2.3.10.in-addr.arpa" q ","; print $0 }' q="'" file2

Try this:

awk -F, '
NR==FNR{a[NR]=$0;next} 
{$7="\047" a[FNR] "\047"} 
{print}' OFS="," file1 file2

Regards

perfect thank you all!