10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
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
...
...... (2 Replies)
Discussion started by: kartikirans
2 Replies
2. Shell Programming and Scripting
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (12 Replies)
Discussion started by: as7951
12 Replies
3. Shell Programming and Scripting
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
Discussion started by: as7951
1 Replies
4. UNIX for Beginners Questions & Answers
Dear Experts,
I have input file which is comma separated, has 4 columns like below,
BRAND,COUNTRY,MODEL,COUNT
NIKE,USA,DUMMY,5
NIKE,USA,ORIGINAL,10
PUMA,FRANCE,DUMMY,20
PUMA,FRANCE,ORIGINAL,15
ADIDAS,ITALY,DUMMY,50
ADIDAS,ITALY,ORIGINAL,50
SPIKE,CHINA,DUMMY,1O
And expected output add... (2 Replies)
Discussion started by: ricky1991
2 Replies
5. Shell Programming and Scripting
Hi
I have attached txt file as input,
and i'm able to calculate sum of columns at the end but the format of sum is not coming up right.
awk -F"," '{for (i=4;i<=NF;i++) sum+=$i}{print}; END { sum="Total:"; for (i=1;i<=NF;i++) {printf sum ","} print "\n"}' input.txt
check the o/p file, at... (6 Replies)
Discussion started by: manas_ranjan
6 Replies
6. Shell Programming and Scripting
HI All,
I'm embedding SQL query in Script which gives following output:
Assignee Group Total
ABC Group1 17
PQR Group2 5
PQR Group3 6
XYZ Group1 10
XYZ Group3 5
I have saved the above output in a file.
How do i sum up the contents of this output so as to get following output:
... (4 Replies)
Discussion started by: Khushbu
4 Replies
7. Shell Programming and Scripting
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Discussion started by: mtucker6784
6 Replies
8. Shell Programming and Scripting
can anyone help me how do i add the colums using awk seperated by character @. for eg i have
3@4
2@9
5@1
the result should be
10 14
i tried using
{ sum+= $1 }
END { print sum }
but it just gives the result 10. can anyone help me with this one
thank you and best regards (7 Replies)
Discussion started by: phone_book
7 Replies
9. Shell Programming and Scripting
I have some data that is something like this?
item: onhand counted location
ITEM0001 1 0 a1
ITEM0001 0 1 a2
ITEM0002 5 0 b5
ITEM0002 0 6 c1
I want to sum up... (6 Replies)
Discussion started by: syadnom
6 Replies
10. Shell Programming and Scripting
Hi I'm new to this forum and I'm a beginner when it comes to shell and awk programming. But I have the following problem:
I have 5 csv files (data1.csv, data2.csv, etc.) and need to calculate the average between the total sum of the 1st and 7 column.
csv example:... (3 Replies)
Discussion started by: sapo51
3 Replies