I want to generate some Summary statistics for "Mary" based on data in multiple files.
input1.txt looks like
Jose 88518 95 75 95 62 100 78 68
Alex 97502 84 79 80 73 88 95 79 85 93
Mary 98765 80 75 100 51 83 75 99 50 75 89 94
...
input2.txt looks like
Jack 32954 100 98 95 100 93 100 99 98 100 100
Mary 98765 85 83 96 77 81 84 98 75 87
Lisa 83746 100 100 100 100 99 100 98 100 100 100
...
Running the following one-liner code in Bash for input1.txt:
awk '/Mary/{for(n=3;n<=NF;n++) print $n}' input1.txt | Rscript -e 'summary (as.numeric (readLines ("stdin")))'
The results are:
Min. 1st Qu. Median Mean 3rd Qu. Max.
50.00 75.00 80.00 79.18 91.50 100.00
Running the following code for input2.txt:
awk '/Mary/{for(n=3;n<=NF;n++) print $n}' input2.txt | Rscript -e 'summary (as.numeric (readLines ("stdin")))'
The results are:
Min. 1st Qu. Median Mean 3rd Qu. Max.
75.00 81.00 84.00 85.11 87.00 98.00
How can I write a one-liner solution to combine "Mary"'s stats from each data file into one report that results in something similar to the following?
Min. 1st Qu. Median Mean 3rd Qu. Max.
50.00 75.00 80.00 79.18 91.50 100.00
75.00 81.00 84.00 85.11 87.00 98.00