Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert values from one file to other, but only specific column

Status
Not open for further replies.

gargamel100

Technical User
Oct 25, 2006
31
CZ
Hi people,
I need your help if somebody know how to do this

I have file like let's say fileA
$11 !~ /^6(1|2)/ && $9 == "2222 " {sum1 = sum1 + $19 }
$11 !~ /^6(1|2)/ && $9 == "80205" {sum15 = sum15 + $19 }
$11 !~ /^6(1|2)/ && $9 == "80206" {sum16 = sum16 + $19 }
$11 !~ /^6(1|2)/ && $9 == "80207" {sum17 = sum17 + $19 }

and fileB
$9 == " 2222" {a=a+1}
$9 == "90000" {k=k+1}
$9 == "80205" {n=n+1}
$9 == "80206" {o=o+1}

this is just excerpt, they are big files cca 300 lines, both. Is ther any way to catenate files A and B, but to change only part $9.... from fileB ( in other words to input values of $9 from fileB into fileAs column $9 ) to fileA. Why I need this. Some values in fileB column $9... are newer than ones I have in fileA, but they should be the same. Both have the same numbers of rows, but that doesn't care, just input values from fileB ($9...) to fileA ($9...) and values in fileA like after catenation.

$11 !~ /^6(1|2)/ && $9 == "2222 " {sum1 = sum1 + $19 }
$11 !~ /^6(1|2)/ && $9 == "90000" {sum15 = sum15 + $19 }
$11 !~ /^6(1|2)/ && $9 == "80205" {sum16 = sum16 + $19 }
$11 !~ /^6(1|2)/ && $9 == "80206" {sum17 = sum17 + $19 }

Regards and thank you.
 
This looks like a bit of a confusing mess :) Are you sure you want to be writing code to modify other code? Perhaps the original code needs to be more intelligent?

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top