mardi 7 juin 2016

awk and sum rows for large files

Gurus,

I have hundred of files to process. Each file contain millions of rows.

Sample file content:

---------------
12
3
5
---------------
8
0
5
---------------
1
5
56
4
---------------

I need to have the output which looks like below (sum of numbers separated by dashes from previous file):

20
13
66

I used while, if, else in conjunction with awk but if/else dramatically slows down the processing.

Any ideas how to use pure awk to speed up calculations?

Regards,

Tasior_Miedziak

Aucun commentaire:

Enregistrer un commentaire