I have a set of data as below:
The first field, $1 represent "|".
The $3 (3rd field) and $6 (6th field) in my data file represent "number-molecule" which has arrangement as below:
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
Any pairs made from above numbers actually represents pairs in the 3rd and 6th field of each line in the data file.
What I want is to select the pairs from the data file made only by the numbers which are arranged at the outer most lines of the above number-molecule ordering.
In short, ANY PAIRS made by only the numbers
(1 2 3 4 5 6 7 8 57 58 59 60 61 62 63 64 9 17 25 33 41 49 57 8 16 24 32 40 48 56 64)
in other words
1 , 2
1 , 3
1 , 4
.
.
1 , 57
1 , 58
1 , 59
.
.
.
2, 1
2, 3
2, 4
2, 5
.
.
.
2, 57
2, 58
2, 59
.
.
.
are need to be deleted from the data file.
To achieve this I have tried to write awk script as below to test to print out the line which I suppose to delete. But at this level I fail to select those line pairs.
#!/usr/bin/awk -f
BEGIN {
i=0
for (n=1; n<=8; n++) set[i++] = n;
for (n=57; n<=64; n++) set[i++] = n;
for (n=9; n<=49; n+=8) {set[i++] = n; set[i++] = n+7};
}
($1== "|") {
split($3, res1, "@"); split($6, res2, "@"); #print res1[1], res2[1]
if ( (res1[1] in set) == (res2[1] in set) );
{
print;
}
}
Can I get any help to resolve this needs?
Thanks in advance