Sponsored Content
Full Discussion: help with add
Top Forums Shell Programming and Scripting help with add Post 302269407 by uwork72 on Wednesday 17th of December 2008 02:29:06 PM
Old 12-17-2008
help with add

Code:
$ cat file
x A 10 20 30
x B 5 10 12
x C 10 4 5
x D 10 3 6
x K 10 23 4
x M 5 7 0

Req o/p:

Code:
x A 15 30 42
x C 20 7 11
x K 15 30 4

Basically I want to add up 2 rows values as above.


I can sum the whole rows

Code:
$ awk '
{ for (i=3;i<=NF;++i) sum[i]+=$i; j=NF}
END {for (i=3;i<=j;++i) printf "%s%s",OFS,sum[i]}' file

 50 67 57

Please help to add two rows values as I mentioned in my req o/p above, thanks.
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

How to add add some files together and then paste

How can you efficiently add pairs of files together and then paste those pairs, I have a climate computer at work which spits out temperatures and stuff out twice a day, one for the day-data and one for the night (basically). Every week I want to make a nice overview The text files are... (1 Reply)
Discussion started by: uwgandalf
1 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy