hello everyone
I need to update data base in file
1-ID
2-Name
3-ID group
4-ID teacher
5-mark list
unique ID is (ID+ID group+ID teacher)
we can append 5 th columns (marks list)
main base file:
Code:
1:John:3:1:4 3 2
2:Mark:1:2:1 3
3:Susan:3:4:
input file:
2:Mark:1:2:1 3 5 6
3:Susan:3:4:2 4 3
main base file after update:
1:John:3:1:4 3 2
2:Mark:1:2:1 3 5 6
3:Susan:3:4:2 4 3
I have a problem with add files to array and with compare student ID
awk 'BEGIN {x=0}{z=0}{y=0}
{getline base[x++] < "base" }
{getline input[z++] < "input" }
END
{for (i in base)
for(n in input)
if (base==input[n]) //I now, it's not OK column 1,3,4 must be ==
output[y++]=input[n]
else
output[y++]=base
}
{for (z in output)
print output[z] > "base"}'