Need Optimization shell/awk script to aggreagte (sum) for all the columns of Huge data file

Tags
advanced, awk, file, script, shell

 
Thread Tools Search this Thread
# 1  
Old 10-23-2018
Need Optimization shell/awk script to aggreagte (sum) for all the columns of Huge data file

Optimization shell/awk script to aggregate (sum) for all the columns of Huge data file

File delimiter "|"
Need to have Sum of all columns, with column number : aggregation (summation) for each column
File not having the header

Like below -
Column 1 "Total
Column 2 : "Total
...
...
Column N : "Total :
# 2  
Old 10-23-2018
Please post a sample representative chunk of a file.
# 3  
Old 10-23-2018
something along these lines:
Code:
awk -F'|' '{for(i=1;i<=NF;i++) a[i]+=$i} END{for(i=1; i in a;i++) printf("Column %d: %d\n", i, a[i])}' myFile

These 2 Users Gave Thanks to vgersh99 For This Post:
kartikirans (10-23-2018) RudiC (10-23-2018)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Sum of columns using awk Rohit Mallah Shell Programming and Scripting 1 08-01-2017 05:43 AM
Script Shell: Count The sum of numbers in a file chercheur111 Shell Programming and Scripting 3 05-23-2016 02:02 PM
awk sum of all columns needs to print exact amount manas_ranjan Shell Programming and Scripting 6 01-26-2016 04:31 PM
awk does not work well with huge data? ariesto Shell Programming and Scripting 4 08-12-2014 12:05 AM
awk - fetch multiple data from huge dump navkanwal Shell Programming and Scripting 5 01-17-2014 04:16 PM
awk processing / Shell Script Processing to remove columns text file ajayram Programming 5 03-23-2013 02:51 PM
awk based script to find the average of all the columns in a data file ks_reddy Shell Programming and Scripting 4 09-06-2012 03:56 PM
Awk based script to find the median of all individual columns in a data file ks_reddy Shell Programming and Scripting 5 06-09-2012 08:19 AM
Sum up values of columns in 4 files using shell script reach.sree@gmai Shell Programming and Scripting 2 06-06-2012 11:20 PM
AWK/Shell script for formatting data in a file rajivnairfis Shell Programming and Scripting 1 05-14-2012 08:57 AM
A variable and sum of its value in a huge data. varungupta UNIX for Advanced & Expert Users 5 05-19-2009 10:08 AM
awk sum columns phone_book Shell Programming and Scripting 7 03-16-2009 11:35 AM
help sum columns by break in first column with awk or sed or something. syadnom Shell Programming and Scripting 6 02-01-2009 05:23 AM
Find percent between sum of 2 columns awk help sapo51 Shell Programming and Scripting 3 10-17-2008 02:43 AM
Shell script to check the unique numbers in huge data namishtiwari Shell Programming and Scripting 7 08-10-2007 10:38 AM