Sponsored Content
Full Discussion: [Solved] Sum operation
Top Forums UNIX for Dummies Questions & Answers [Solved] Sum operation Post 302874025 by radius on Wednesday 13th of November 2013 09:02:03 PM
Old 11-13-2013
big thanks..both code is correct..seems the last code is quicker
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with sum operation

i wrote this code.. #!/bin/sh sum=0 for i in `cat numbers.txt |cut -f1` do sum=expr $sum + $i done echo $sum I want to read the numbers in the file numbers.txt. and find sum of them. But this code only writes the numbers(without making sum) that it reads. Help me.. (2 Replies)
Discussion started by: burakkilic
2 Replies

2. Shell Programming and Scripting

Print sum and relative value of the sum

Hi i data looks like this: student 1 Subject1 45 55 Subject2 44 55 Subject3 33 44 // student 2 Subject1 45 55 Subject2 44 55 Subject3 33 44 i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and... (2 Replies)
Discussion started by: saint2006
2 Replies

3. Shell Programming and Scripting

Column operation : cosne and sine operation

I have a txt file with several columns and i want to peform an operation on two columns and output it to a new txt file . file.txt 900.00000 1 1 1 500.00000 500.00000 100000.000 4 4 1.45257346E-07 899.10834 ... (4 Replies)
Discussion started by: shashi792
4 Replies

4. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

5. Shell Programming and Scripting

[SOLVED] Awk one line to sum up a function

I need help with debugging an error in my awk script. I have a shell script with variable named U_new_i and want to pass it to awk for use in a summation. The original file have the following content. cat test.txt -2445.7132000000 -2444.9349000000 -2444.3295000000 -2443.1814000000 ... (0 Replies)
Discussion started by: Quantum_Dot
0 Replies

6. Shell Programming and Scripting

[Solved] Mathematical operation in multiple files

Hi experts, I need to do a mathematical calculation between each data in 3 different files. Output is using formula (A11+B11)/(1+C11). INPUT : File A.txt A11 A12 A21 A22 File B.txt B11 B12 B21 B22 File C.txt C11 C12 C21 C22 OUTPUT: (A11+B11)/(1+C11) (A12+B12)/(1+C12)... (3 Replies)
Discussion started by: guns
3 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Remove Duplicates and Sum in a spreadsheet

Hi all, I have a problem hoping someone can help me. I have this spreadsheet : PC.333 PC.444 PC.555 PC.666 PC.777 0 0 ... (2 Replies)
Discussion started by: Giorgio C
2 Replies

8. Shell Programming and Scripting

[Solved] sum up third and second columns by 0 difference

Hi Friends, I have the following file chr1 1 2 chr1 2 3 chr1 3 4 chr1 4 5 chr1 5 6 chr1 19 20 chr1 20 21 chr1 21 22 I want to compare the third column of record 1 to second column of next record and if the difference is zero, consider its third column and match it to next record... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

9. Shell Programming and Scripting

[Solved] Perform an operation to all directories

Sorry, about this thread - I solved my own problem! Thanks for taking a look. edit by bakunin: no problem, but it would have been a nice touch to actually tell us what the solution was. This would have been slightlich more educating than just knowing that you found it. I changed your title to... (0 Replies)
Discussion started by: Blue Solo
0 Replies

10. Shell Programming and Scripting

Do replace operation and awk to sum multiple columns if another column has duplicate values

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
Dev(3)							User Contributed Perl Documentation						    Dev(3)

NAME
PDL::Core::Dev - PDL development module DESCRIPTION
This module encapsulates most of the stuff useful for PDL development and is often used from within Makefile.PL's. SYNOPSIS
use PDL::Core::Dev; FUNCTIONS
isbigendian Is the machine big or little endian? print "Your machins is big endian. " if isbigendian(); returns 1 if the machine is big endian, 0 if little endian, or dies if neither. It uses the "byteorder" element of perl's %Config array. my $retval = isbigendian(); trylink a perl configure clone if (trylink 'libGL', '', 'char glBegin(); glBegin();', '-lGL') { $libs = '-lGLU -lGL'; $have_GL = 1; } else { $have_GL = 0; } $maybe = trylink 'libwhatever', $inc, $body, $libs, $cflags, {MakeMaker=>1, Hide=>0, Clean=>1}; Try to link some C-code making up the body of a function with a given set of library specifiers return 1 if successful, 0 otherwise trylink $infomsg, $include, $progbody, $libs [,$cflags,{OPTIONS}]; Takes 4 + 2 optional arguments. o an informational message to print (can be empty) o any commands to be included at the top of the generated C program (typically something like "#include "mylib.h"") o the body of the program (in function main) o library flags to use for linking. Preprocessing by MakeMaker should be performed as needed (see options and example). o compilation flags. For example, something like "-I/usr/local/lib". Optional argument. Empty if omitted. o OPTIONS MakeMaker Preprocess library strings in the way MakeMaker does things. This is advisable to ensure that your code will actually work after the link specs have been processed by MakeMaker. Hide Controls if linking output etc is hidden from the user or not. On by default except within the build of the PDL distribution where the config value set in perldl.conf prevails. Clean Remove temporary files. Enabled by default. You might want to switch it off during debugging. perl v5.12.1 2009-12-27 Dev(3)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy