10-19-2007
How to perfrom summation for particular delimited field?
Hi,
Please help to share your thought about how to perfrom summation for particular delimited field, and output to the particular file based on
HTML Code:
-rw-r--r-- 1 abc other 3094 Oct 19 09:40 0132019832-ps5_online_cdrm.unl
-rw-r--r-- 1 abc other 1588 Oct 19 09:47 0132019832-ps5_online_cdrn.unl
-rw-r--r-- 1 abc other 2523 Oct 19 09:54 0132019832-ps5_online_cdro.unl
-rw-r--r-- 1 abc other 947 Oct 19 10:01 0132019832-ps5_online_cdrp.unl
-rw-r--r-- 1 abc other 1300 Oct 19 10:09 0132019832-ps5_online_cdrq.unl
-rw-r--r-- 1 abc other 410 Oct 19 10:16 0132019832-ps5_online_cdrr.unl
-rw-r--r-- 1 abc other 4253 Oct 19 10:23 0132019832-ps5_online_cdrs.unl
-rw-r--r-- 1 abc other 10195 Oct 19 10:31 0132019832-ps5_online_cdrt.unl
-rw-r--r-- 1 abc other 1053 Oct 19 10:38 0132019832-ps5_online_cdru.unl
Each file will have content like this in which separated with delimiter "|".
HTML Code:
1603823|010|4|CDR|0132019832|||3002|0194212739|||||||N|Y|Y|2007-08-30 23:42:42|||17||-0.1|16.5951|||MO019|-0.1|16.5951|0|||
1603863|010|4|CDR|0132019832|||3002|01997564444|||||||N|Y|Y|2007-08-30 23:42:53|||14||-0.1|16.4251|||MO019|-0.1|16.4251|0|||
1603912|010|4|CDR|0132019832|||3005|0135305303|||||||N|Y|Y|2007-08-30 23:43:07|||9||-0.1|16.1851||3GMid|MO013|-0.1|16.1851|0|||
1603930|010|4|CDR|0132019832|||3002|0192504561|||||||N|Y|Y|2007-08-30 23:43:13|||17||-0.1|16.0851|||MO019|-0.1|16.0851|0|||
1603948|010|4|CDR|0132019832|||3004|0126440226|||||||N|Y|Y|2007-08-30 23:43:18|||15||-0.2|15.8851|||MO012|-0.2|15.8851|0|||
1603975|010|4|CDR|0132019832|||3007|0175152680|||||||N|Y|Y|2007-08-30 23:43:28|||13||-0.2|15.6151|||MO017|-0.2|15.6151|0|||
1603996|010|4|CDR|0132019832|||3004|0125329005|||||||N|Y|Y|2007-08-30 23:43:34|||18||-0.2|15.4151|||MO012|-0.2|15.4151|0|||
1604034|010|4|CDR|0132019832|||3005|0137508649|||||||N|Y|Y|2007-08-30 23:43:44|||11||-0.1|15.2451|||MO013|-0.1|15.2451|0|||
The ultimate result of all values in field 24 will be summed up and output to file say a.txt ,while field 5 and total sum value must be separated by "|"
Say when cat output(a.txt)
0132019832| -1.1
Need help...!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a large file with fields delimited by '|', and I want to run some analysis on it. What I want to do is count how many times each field is populated, or list the frequency of population for each field.
I am in a Sun OS environment.
Thanks,
- CB (3 Replies)
Discussion started by: ChicagoBlues
3 Replies
2. Shell Programming and Scripting
Hello,
Can someone help me to do this with awk or sed? I have a file with multiple lines, each line has many fields separated with a tab. I would like to add one more field holding 'na' in between the first and second fields.
old file looks like,
1, field1 field2 field3 ...
2, field1... (7 Replies)
Discussion started by: ssshen
7 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I have about 100 files in a directory with fields which are tab delimited. I would like to append the file name as the first field and it has to be done as many times as the total lines in the file.
For example,
myFile1.txt has the following data:
1 x y z
2 a b ... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies
4. Shell Programming and Scripting
Hi everyone!
How can I parse a delimited field using AWK?
For example, if I have lastName#firstName or lastName*firstName. I'd like an AWK script that would return lastName and then another that would return firstName? Is this possible? (13 Replies)
Discussion started by: Fatbob
13 Replies
5. Shell Programming and Scripting
Need help. I tried using an awk command to pad zeroes. Unfortunately, the "|" pipe delimited character is gone when I tried to write the records to another file.
awk -F \| ' {$1=sprintf("%06s", $1); print $0}' $CUSTFINAL2 > $CUSTFINAL3
BEFORE
"KEYRECORD"|"SA ID"|"PER ID"|"SP ID"|"ACCT... (3 Replies)
Discussion started by: johnhips
3 Replies
6. UNIX for Dummies Questions & Answers
i need to add a new field in a pipe delimited line. the field will be the current date today.
aa|a|s|w|1
as|oiy|oiy|oiy|2
given that all lines are uniformed in the number of fields
i want it to look like this:\
aa|a|s|w|1|20120126
as|oiy|oiy|oiy|2|20120126
please help :) (3 Replies)
Discussion started by: kokoro
3 Replies
7. Programming
Hi,
We need to produce a XML file based on a record/field delimited data file. At this point we could just script something out but I would like to ask the community what would be the best choice of programming language to do this, in terms of performance of execution, and in terms of complexity... (9 Replies)
Discussion started by: Indalecio
9 Replies
8. Shell Programming and Scripting
Hi,
I have a '~' delimited file and i want to remove the last field using awk. Please find the sample records below:
1428128~1~0~1100426~003~50220~005~14~0~194801~11~0~3~14~0~50419052335~0~0820652001~2~00653862 ~0~1~0~00126~1~20000110~20110423~R~ ~0~Z~1662.94~ ~002041~0045~Z~... (3 Replies)
Discussion started by: Arun Mishra
3 Replies
9. Shell Programming and Scripting
Awk gurus,
Greatly appreciate for any kind of assistance from the expert community
Input line:
abc,11.22.33.44,xyz,7-8-9-10
pqr,111.222.333.444,wxy,1-2-3
def,22.33.44.55,stu,7-8
used the gsub function below but it changes all of the "-" delimiter:
awk 'gsub("-",",")'
Desired... (4 Replies)
Discussion started by: ux4me
4 Replies
10. Shell Programming and Scripting
Hi,
I have the requirement similar to the one mentioned in the below thread.
https://www.unix.com/unix-for-dummies-questions-and-answers/128155-search-replace-string-only-particular-column-delimited-file.html
The only difference is that I need to change the field for row 1,2 and the last... (14 Replies)
Discussion started by: chetanojha
14 Replies
LEARN ABOUT DEBIAN
types.db
TYPES.DB(5) collectd TYPES.DB(5)
NAME
types.db - Data-set specifications for the system statistics collection daemon collectd
SYNOPSIS
bitrate value:GAUGE:0:4294967295
counter value:COUNTER:U:U
if_octets rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
DESCRIPTION
The types.db file contains one line for each data-set specification. Each line consists of two fields delimited by spaces and/or horizontal
tabs. The first field defines the name of the data-set, while the second field defines a list of data-source specifications, delimited by
spaces and, optionally, a comma (",") right after each list-entry.
The format of the data-source specification has been inspired by RRDtool's data-source specification. Each data-source is defined by a
quadruple made up of the data-source name, type, minimal and maximal values, delimited by colons (":"): ds-name:ds-type:min:max. ds-type
may be either ABSOLUTE, COUNTER, DERIVE, or GAUGE. min and max define the range of valid values for data stored for this data-source. If U
is specified for either the min or max value, it will be set to unknown, meaning that no range checks will happen. See rrdcreate(1) for
more details.
FILES
The location of the types.db file is defined by the TypesDB configuration option (see collectd.conf(5)). It defaults to collectd's shared
data directory, i. e. prefix/share/collectd/.
CUSTOM TYPES
If you want to specify custom types, you should do so by specifying a custom file in addition to the default one (see FILES) above. You can
do that by having multiple TypesDB statements in your configuration file or by specifying more than one file in one line.
For example:
TypesDB "/opt/collectd/share/collectd/types.db"
TypesDB "/opt/collectd/etc/types.db.custom"
Note: Make sure to make this file available on all systems if you're sending values over the network.
SEE ALSO
collectd(1), collectd.conf(5), rrdcreate(1)
AUTHOR
collectd has been written by Florian Forster <octo at verplant.org>.
This manpage has been written by Sebastian Harl <sh at tokkee.org>.
5.1.0 2012-04-02 TYPES.DB(5)