where the field 'flag' identifies different groups. I'd like to obtain statistics on each group and save it in an output file. I'm not an expert user and it is not clear to me if it is possible to tell awk to take the first 3 lines, calculate the relevant stat (piping the first two columns of the first three lines to another shell command), print the output and move to the following group (last four lines).
Any help? Thanks in advance.
where STAT_CMD produces a statistics on the first two columns and the value '1' is dynamically replaced by the third field in the temp file, grouping lines according to the value of the flag.
In my example the output will be two numbers reporting the output STAT_CMD (ex. the correlation between the two) applied on these two pairs of columns (identified by the flag)
STAT_CMD it's C program to calculate the Spearman rank correlation coefficient between two columns. I've checked and it seems that even without piping the output of gawk to my STAT_CMD it remains slow.