Skip to content

How to sum two csv files with the same number of columns with the same number of rows? #1460

Answered by aborruso
OpenFoam-User asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @OpenFoam-User , sorry I didn't understand.

If you want stats by field, the verb is merge-fields. Running

cp sample.txt s.txt
for letter in x u v w; do
    mlr -I --csv merge-fields -a mean -r "^$letter" -o "$letter" s.txt
done

You get the below result. Is that what you want?

+---------------+--------------------+------------------------+-------------------------------------------+
| x_mean        | u_mean             | v_mean                 | w_mean                                    |
+---------------+--------------------+------------------------+-------------------------------------------+
| -3            | 9.44069664125      | -0.2352999882          | -0.0000000000000000000058818…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@OpenFoam-User
Comment options

@aborruso
Comment options

@OpenFoam-User
Comment options

@aborruso
Comment options

Answer selected by OpenFoam-User
@OpenFoam-User
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants