Hi, I have two files. E.g:
file a: 486 -1.47 38.1073
file b: 486 -1.97 34.7981 -3.35
and this is my script so far:
awk '
BEGIN {
while (getline < "file b") {
count[$1]=$2
}
}
{
if (count[$1])
print $1, $2*-1, $3, count[$1]*-1}' file a > out
I also want to print $4 of file b as well, but i get weird results ( i tried adding maxd[$2]=$4 after the count array)
how do i do this?
cheers
file a: 486 -1.47 38.1073
file b: 486 -1.97 34.7981 -3.35
and this is my script so far:
awk '
BEGIN {
while (getline < "file b") {
count[$1]=$2
}
}
{
if (count[$1])
print $1, $2*-1, $3, count[$1]*-1}' file a > out
I also want to print $4 of file b as well, but i get weird results ( i tried adding maxd[$2]=$4 after the count array)
how do i do this?
cheers