I need to calculat the sum of the particular field in text file. And the datatype of the field in file is decimal(18,2). If the file is small, then I am facing any problem. But the file is huge, then the result is converted into exponential format.
I tried using various command thr this forum, but still facing the problem.
Thanks in advance.
Moderator's Comments:
This is the 3rd homework violation. The homework template must be filled in when posting to the Homework & Coursework forum. This thread is closed.
Last edited by Don Cragun; 09-02-2013 at 07:46 AM..
The file content is dynamic and using this format:
name1 number1
name2 number2
name3 number3
name4 number4
....................
Need a smooth way to calculate the sum of all the numbers in that file (number1 + number2 + number3 + number4........ = total ) (11 Replies)
how to sum particular field in text file
i am having text file like
222|4000|abc
333|5000|xyz
444|6000|mno
i want sum of second field
i.e 4000+5000+6000
can u pls help (3 Replies)
Hi,
I wanted a script to find sum of files for a particular date, below is my script
ls -lrt *.req | nawk '$6 == "Aug"' | nawk '$7 == "1"'| awk '{sum = sum + $5} END {print sum}'
However, i get the error below
/usr/bin/ls: arg list too long
How do i fix that.
Many thanks before. (2 Replies)
Hi Everyone,
($total+=$_) for @record;
assume @record=(1,2,3), so the result is 6.
if @record=("1 3","2 3","3 3"), would like to sum up the 2nd field of this array, the result is 9.
i tried " ($total+=$) for @record ", cannot, please advice.
Thanks
---------- Post updated at 03:45... (1 Reply)
this is part of a KT i am going thru.
i am writing a script in bash shell, linux where i have 2 columns where 1st signifies the nth hour like 00, 01, 02...23 and 2nd the file size.
sample data attached.
Desired output is 3 columns which will give the nth hour, number of entries in nth hour and... (3 Replies)
srec_tektronix_extended(5) File Formats Manual srec_tektronix_extended(5)NAME
srec_tektronix_extended - Tektronix Extended hexadecimal file format
DESCRIPTION
This format allows binary files to be uploaded and downloaded between two computer systems, typically between a computer system (such as a
PC, Macintosh, or workstation) and an emulator or evaluation board for microcontrollers and microprocessors.
The Lines
Lines always start with a percent (%) character. Each line consists of 5 fields. These are the length field, the type field, the check-
sum, the address field (including address length), and the data field.
The Fields
+--+--------+------+----------+---------+------+
|% | Length | Type | Checksum | Address | Data |
+--+--------+------+----------+---------+------+
Record Length
The record length field is a 2 character (1 byte) field that specifies the number of characters (not bytes) in the record, exclud-
ing the percent, the length field, the type field and the checksum.
Type The type field is a 1 character field that specifies whether the record is data (6) or termination (8).
Checksum
The checksum is an 2 character (1 byte) field that represents the sum of all the nibbles on the line, excluding the checksum.
Address This is a 9 character field. The first character is the address size; it is always 8. The remaining 8 chgaracters are the 4-byte
address that specifies where the data is to be loaded into memory.
Data The data field contains the executable code, memory-loadable data or descriptive information to be transferred.
Record Types
6 A record containing data. The data is placed at the address specified.
8 A termination record. The address field may optionally contain the address of the instruction to which control is passed. There
is no data field.
Size Multiplier
In general, binary data will expand in sized by approximately 2.5 times when represented with this format.
EXAMPLE
Here is an example Tektronix extended file. It contains the data "Hello, World[rq] to be loaded at address 0x006B.
%256D980000006B48656C6C6F2C20576F726C64210A
%09819800000000
COPYRIGHT
srec_cat version 1.58
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Peter Miller
The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use the 'srec_cat -VERSion License' command. This is free software and
you are welcome to redistribute it under certain conditions; for details use the 'srec_cat -VERSion License' command.
AUTHOR
Peter Miller E-Mail: pmiller@opensource.org.au
//* WWW: http://miller.emu.id.au/pmiller/
Reference Manual SRecord srec_tektronix_extended(5)