I'm new to this forum. So please be patience with me!
I have a file that looks like this (all rows have the same number of columns):
I want to sum the value of first field to all the remaining ones for every rows. So, for NR==1, all the values (after the first field) will be summed by 19; and for NR==2, all the values (after the first field) will be summed by 10 and so on...
Thanks a lot.
Best
Aderson Nascimento
Last edited by jim mcnamara; 12-15-2012 at 05:52 PM..
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)
Hi All,
happy new year.
I have a file with 4xN columns like
0.0000e+00 0.0000e+00 7.199E+07 7.123E+07 6.976E+07 6.482E+07 5.256E+07 2.523E+07
0.0000e+00 0.0000e+00 8.641E+07 8.550E+07 8.373E+07 7.780E+07 6.309E+07 3.028E+07... (8 Replies)
Hi,
i want to find out the sum of a column in vi/vim not by using any other editor or filter like sed/awk. Is there any function available to do the sum of a column.
let
cat>number.txt
one 1
two 2
five 5
nine 9
here i want the sum of second field is 17, is there any function to... (3 Replies)
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)
My File looks like:
"|" -> Field separator
A|B|C|100|1000
D|E|F|1|2
G|H|I|0|7
D|E|F|1|2
A|B|C|10|10000
G|H|I|0|7
A|B|C|1|100
D|E|F|1|2
I need to do a SUM on Col. 5 and Col.6 by grouping on Col 1,2 & 3
My expected output is:
A|B|C|111|11100 (2 Replies)
Hi Friends,
I have a file with fields separated with comma. How to print sum of each field of the file?
Eg:
input file
1,3,6,7
2,1,2,1
0,1,1,0
I want to sum each field separately.
Output file
3,5,9,8
Thanks,
Suresh (2 Replies)
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)
HI Guys,
I gave Input file F.Txt
ID H1 H2 H3 H4 H5
A 5 6 7 8 9
B 4 65 4 4 7
C 4 4 4 4 4
D 4 4 4 4 4
Output :-
ID H1 H2 H3 H4 H5
Total 17 79 19 20 24
Sum of Each Columns (8 Replies)
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
LEARN ABOUT NETBSD
dup_field
FORMS(3) BSD Library Functions Manual FORMS(3)NAME
dup_field, free_field, link_field, new_field -- form library
LIBRARY
Curses Form Library (libform, -lform)
SYNOPSIS
#include <form.h>
FIELD *
dup_field(FIELD *field, int frow, int fcol);
int
free_field(FIELD *field);
FIELD *
link_field(FIELD *field, int frow, int fcol);
FIELD *
new_field(int rows, int cols, int frow, int fcol, int nrows, int nbuf);
DESCRIPTION
The dup_field() function duplicates the given field, including any buffers associated with the field and returns the pointer to the newly
created field. free_field() destroys the field and frees any allocated resources associated with the field. The function link_field()
copies the given field to a new field at the location frow and fcol but shares the buffers with the original field. new_field() creates a
new field of size rows by cols at location frow, fcol on the page, the argument nrows specified the number of off screen rows the field has
and the nbuf parameter specifies the number of extra buffers attached to the field. There will always be one buffer associated with a field.
RETURN VALUES
On error dup_field() and new_field() will return NULL. The functions will one of the following error values:
E_OK The function was successful.
E_BAD_ARGUMENT A bad argument was passed to the function.
E_CONNECTED The field is connected to a form.
SEE ALSO curses(3), forms(3)NOTES
The header <form.h> automatically includes both <curses.h> and <eti.h>.
BSD January 1, 2001 BSD