#!/usr/bin/awk -f
# ----------------------------------------------
# When the line has data NF>1, in our case NF=6:
NF>1{
 t  =$2;      
 x  =$3;
 rho=$4;
 if(x<0) R += rho;
 if(x>0) T += rho;

}
# A blank line separates datasets of different time:
NF<1{ 
 dx =0.02;     # put here the value of dx
 R *=dx;       # ~ ∫     x * ρ(χ,t) *  dx
 T *=dx;       
 print t,R,T;
 R=0;T=0;     # reset sums for the next dataset
}
