Sponsored Content
Top Forums Shell Programming and Scripting Taking sum up all values inside the file Post 302666197 by NareshN on Wednesday 4th of July 2012 01:39:33 AM
Old 07-04-2012
Taking sum up all values inside the file

Hi,

Taking sum up all values inside the file by using the below command:

paste -sd+ filenmae | bc

Getting some error like "0705-001: building space exceeded on line1 stdin"

The original data looks like

SPACE SPACE SPACE 0.123 [.\] JOBNAME1
SPACE SPACE 20.325 [.\] JOBNAME2
SPACE SPACE SPACE SPACE SPACE 402.238 [.\] JOBNAME3

Like that, some thousands of records for four files. By using sed command, removing all the starting spaces in a file and storing vlaues(i.e., cpu time) column alone in a file and trying take to the count by using paste command.

I tried to use different scenarios to take the count by using awk, eventhough am getting same error.

The error is displaying for few files only. I verified the file contents there is no spaces or empty rows.

Thanks for you help in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Please help me in taking the values from a file

i have a script, whcih takes values from a file and assign it to one variable. this text value contains name of few object. value contains line by lie. i.e. one after another. when i am assaign the value of this text file to a variable, it accept the value as one liner instead of one by one.... (3 Replies)
Discussion started by: jin
3 Replies

2. Shell Programming and Scripting

How To Sum Values Inside One Line In UNIX.?

Dears, Good Day ! Plz; i want to sum-up two consecutive values inside one row, and put the summation in a new column. here the input: 1 2 4 5 6 7 the output should be: 1 2 3 4 5 9 6 7 13 If someone can help me to solve my issue ! thx anyway. Video tutorial on how to use... (5 Replies)
Discussion started by: Ala Alzyadat
5 Replies

3. Shell Programming and Scripting

Get the sum of values in between begin and end in the file

Hi All, test file Begin Script Run at Thu Mar 14 09:24:16 PDT 2013 tst_accounts: ws zip: WS_out_20130313.tar.gz dat: test_20130313.dat count: 63574 loaded: xx pre-merge: xx post-merge: xx timestamp: Thu Mar 14 09:30:42 PDT 2013 tst_accounts: ws zip: WS_out_20130313.tar.gz dat: s_20130313.dat... (6 Replies)
Discussion started by: bmk
6 Replies

4. Shell Programming and Scripting

How to find sum of any 'n' number of values from file matching target value?

I have a simple text file having payment amount value on each line. At the end of day 'n' number of payments created difference in amount that I need to match from this file. I have information about how many payments created difference and difference amount. Please help me to build shell... (3 Replies)
Discussion started by: swats007
3 Replies

5. Shell Programming and Scripting

Sum values of specific column in multiple files, considering ranges defined in another file

I have a file (let say file B) like this: File B: A1 3 5 A1 7 9 A2 2 5 A3 1 3 The first column defines a filename and the other two define a range in that specific file. In the same directory, I have also three more files (File A1, A2 and A3). Here is 10 sample lines... (3 Replies)
Discussion started by: Bastami
3 Replies

6. Shell Programming and Scripting

SUM semicolon-seperated values from txt-file

Hello, (I'm a shell beginner) how can I sum the bold values of the following txt-file (values.txt) with bash shell. The result of the sum should be written in a new txt file (sum.txt): ... Thanks in advance (5 Replies)
Discussion started by: milu
5 Replies

7. Shell Programming and Scripting

Sum duplicate values in text file through awk between dates

I need to sum values in text file in case duplicate row are present with same name and different value below is example of data in file i have and format i need. Data in text file 20170308 PM,U,2 PM,U,113 PM,I,123 DA,U,135 DA,I,113 DA,I,1 20170309 PM,U,2 PM,U,1 PM,I,123 PM,I,1... (3 Replies)
Discussion started by: Adfire
3 Replies

8. Shell Programming and Scripting

Taking key values from one file and extracting values from another file

Hi, I have two files with values in both. File1: cat 2 3 dog 4 5 elephant 6 7 camel 2 3 File2: ----+--gkf;ajf= ---+---- +----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9 ----++-- elephant | 5 | 7 ---++ camel ------ ++++_---- || 8 | 9 I want the final file as: cat 4... (1 Reply)
Discussion started by: npatwardhan
1 Replies

9. UNIX for Beginners Questions & Answers

Copy columns from one file into another and get sum of column values and row count

I have a file abc.csv, from which I need column 24(PurchaseOrder_TotalCost) to get the sum_of_amounts with date and row count into another file say output.csv abc.csv- UTF-8,,,,,,,,,,,,,,,,,,,,,,,,, ... (6 Replies)
Discussion started by: Tahir_M
6 Replies

10. UNIX for Beginners Questions & Answers

Replacing values inside a file.

Good day guys, I'm having trouble in creating a logic when it comes to replacing the values inside a file. I tried using sed command but it just doesn't work the way I want it to be. Here is what I'm trying to achieve. If my input file contains the values below. NAME++GUEST1 ++GUESS2++... (3 Replies)
Discussion started by: asdfghjkl
3 Replies
TCP_TABLE(5)							File Formats Manual						      TCP_TABLE(5)

NAME
tcp_table - Postfix client/server table lookup protocol SYNOPSIS
postmap -q "string" tcp:host:port postmap -q - tcp:host:port <inputfile DESCRIPTION
The Postfix mail system uses optional tables for address rewriting or mail routing. These tables are usually in dbm or db format. Alterna- tively, table lookups can be directed to a TCP server. To find out what types of lookup tables your Postfix system supports use the "postconf -m" command. To test lookup tables, use the "postmap -q" command as described in the SYNOPSIS above. PROTOCOL DESCRIPTION
The TCP map class implements a very simple protocol: the client sends a request, and the server sends one reply. Requests and replies are sent as one line of ASCII text, terminated by the ASCII newline character. Request and reply parameters (see below) are separated by white- space. Send and receive operations must complete in 100 seconds. REQUEST FORMAT
Each request specifies a command, a lookup key, and possibly a lookup result. get SPACE key NEWLINE Look up data under the specified key. put SPACE key SPACE value NEWLINE This request is currently not implemented. REPLY FORMAT
Each reply specifies a status code and text. Replies must be no longer than 4096 characters including the newline terminator. 500 SPACE text NEWLINE In case of a lookup request, the requested data does not exist. In case of an update request, the request was rejected. The text describes the nature of the problem. 400 SPACE text NEWLINE This indicates an error condition. The text describes the nature of the problem. The client should retry the request later. 200 SPACE text NEWLINE The request was successful. In the case of a lookup request, the text contains an encoded version of the requested data. ENCODING
In request and reply parameters, the character %, each non-printing character, and each whitespace character must be replaced by %XX, where XX is the corresponding ASCII hexadecimal character value. The hexadecimal codes can be specified in any case (upper, lower, mixed). The Postfix client always encodes a request. The server may omit the encoding as long as the reply is guaranteed to not contain the % or NEWLINE character. SECURITY
Do not use TCP lookup tables for security critical purposes. The client-server connection is not protected and the server is not authenti- cated. BUGS
Only the lookup method is currently implemented. The client does not hang up when the connection is idle for a long time. SEE ALSO
postmap(1), Postfix lookup table manager regexp_table(5), format of regular expression tables pcre_table(5), format of PCRE tables cidr_table(5), format of CIDR tables README FILES
Use "postconf readme_directory" or "postconf html_directory" to locate this information. DATABASE_README, Postfix lookup table overview LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA TCP_TABLE(5)
All times are GMT -4. The time now is 04:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy