Dear Vger
i have another pattern which look like this :
2 20080222_19:42:33.407 ISC-Libya Belgium1 8 IAM 38733614670 218214834748 b 2761 ACM b 20101 ANM f 89238 REL b 89541 SUS b 90221 RLC :COMMA: NCI=00,FCI=6100,CPC=0A,TMR=03: :COMMB: BCI=1604,OBI=01: :RELCAUSE:10:
For this pattern i want to subtract the field before ANM word from the field before ACM word and if the result is less than 1000 i should print the whole pattern and sure skip the patterns which don't achieve this condition and at the end i like to redirect the output to another file.
Note also the position of ACM and ANM is not fixed for the all the patterns.
Can you tell me if the below code is right:
{
foo= "<unknown>"
too= "<unknown>"
result="<unknown>"
for (i =1 ; i<= NF; i++)
if (i>2 && $i == "ANM") {
foo = $(i-1)
break
}
for (k=1 ;k<=NF;i++)
if(k>2 && $k == "ACM"{
too =$(k-1)
break
}
result == too - foo
if (result <=1000){
print $0
}
( is $0 refer to printing the whole line where the condition is achieved)
then after printing the output i want to redirect it to a separate file.
I am sure that the code need modification so please update it if it need modification to try it on my server
Thanks in advance
