09-02-2008
Sorry thanks for your replies but i didn't put the entire file so here it is:
200808260640 0 11383
200808210640 0
200808300640 0
200808300640 0
200808300640 0
200808260640 336528522 8844
200808260640 724271039 8080
200808260640 583502861 8077
200808210640 0
200808210640 0
200808210640 0
200808290640 0
200808290640 0
200808290640 0
200808290640 0
200808150640 0 7667
200808160640 0 3285
200808310640 0
200808150640 634799861 4703
200808150640 329658775 4704
200808150640 588901581 4875
200808160640 201718658 1424
What i want to do is sum all the $2 for the same date and save the $3 for that date. E.g like a posted in the first post.
200808150640 0 7667
200808150640 634799861 4703
200808150640 329658775 4704
200808150640 588901581 4875
Expected result:
200808150640 (634799861+329658775+588901581) 7667
i want to do this for the entirely file . Many thanks in advice.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
This goes deeper into the date thing. I want to be able to check the date and time stamp in or on a file to see what the time span is.
We have a job that runs several times an hour - kicked off through cron based on a trigger file. We want to keep track of each run and check the time between... (14 Replies)
Discussion started by: MizzGail
14 Replies
2. Shell Programming and Scripting
Hi,consider this fields,
$1 $2 $3
981 0 1
984 0 4
985 1 0
987 0 2
990 0 0
993 0 3
995 2 0
996 0 1
999 0 4
for each occurence of zero in column $2 and $3 I need to sum $1 fields, so for example, in this piece of code the result of $1 is 8910. I'm sure... (2 Replies)
Discussion started by: cv313x
2 Replies
3. Shell Programming and Scripting
Hi All,
I have some folder that are named "FOLDERYYYYMM". I'm trying to piece together a .sh script that will look for the folder with the date. How can I get shell to see the date? (3 Replies)
Discussion started by: bbbngowc
3 Replies
4. Shell Programming and Scripting
Hi Experts,
I am adding a column of numbers with awk , however not getting correct output:
# awk '{sum+=$1} END {print sum}' datafile
2.15291e+06
How can I getthe output like : 2152910
Thank you..
# awk '{sum+=$1} END {print sum}' datafile
2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies
5. Shell Programming and Scripting
Hi all,
I need to sum values for fields in a delimited file as below:
2010-03-05|||
2010-03-05|||123
2010-03-05|467.621|369.532|
2010-03-06|||
2010-03-06||2|
2010-03-06|||444
2010-03-07|||
2010-03-07|||
2010-03-07|655.456|1019.301|
Code used is:
nawk -F "|" ' { sum +=... (7 Replies)
Discussion started by: Katabatic
7 Replies
6. UNIX for Dummies Questions & Answers
Hi everyone, i need help with a simple task. I have a file withe the format:
"01/20/2012 23:10:13.979","49","49","48","19"
"01/20/2012 23:15:13.969","47","47","48","18"
"01/20/2012 23:20:13.975","47","47","45","17"
"01/20/2012 23:25:13.980","44","44","44","17"
"01/20/2012... (3 Replies)
Discussion started by: civilianwarfare
3 Replies
7. Shell Programming and Scripting
I need to use awk to return lines in multiple files that contain a date between a start date and end date. The format of the date is as seen in column 3 in the following line.
A,1458147240,Mar 30 2015 12:54:00PM,s15u4chn ,2,GPS Major Alarm `clear`,component.Channel,10,15,0,138,183,,,Mar 16... (4 Replies)
Discussion started by: randman1
4 Replies
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
This is my file
vol0 285GB
vol0.snapshot 15GB
vol11_root 0GB
vol12_root 47GB
vol12_root.snapshot 2GB
I need the output
vol0 285GB,vol0.snapshot 15GB,sum-300GB
vol11_root 0GB,nosnap,sum-0Gb
vol12_root 47GB,vol12_root.snapshot 2GB,49GB
I was trying to use paste -d, --. But... (9 Replies)
Discussion started by: ranjancom2000
9 Replies
10. Shell Programming and Scripting
Hi Unix Gurus
Let's say I have the input files like the following. I need to pick the files based on my run date.
abcd_20180206.csv
abcd_20180213.csv
abcd_20180220.csv
abcd_20180227.csv
efgh_20180206.csv
efgh_20180220.csv
efgh_20180227.csv
ijkl_20180206.csv
ijkl_20180213.csv... (9 Replies)
Discussion started by: SK123
9 Replies
LEARN ABOUT CENTOS
iso8601
PACEMAKER(8) System Administration Utilities PACEMAKER(8)
NAME
Pacemaker - Part of the Pacemaker cluster resource manager
SYNOPSIS
iso8601 command [output modifier]
DESCRIPTION
iso8601 - Display and parse ISO8601 dates and times
OPTIONS
-?, --help
This text
-$, --version
Version information
-V, --verbose
Increase debug output
Commands:
-n, --now
Display the current date/time
-d, --date=value
Parse an ISO8601 date/time. Eg. '2005-01-20 00:30:00 +01:00' or '2005-040'
-p, --period=value
Parse an ISO8601 date/time with interval/period (wth start time). Eg. '2005-040/2005-043'
-D, --duration=value
Parse an ISO8601 date/time with duration (wth start time). Eg. '2005-040/P1M'
-E, --expected=value
Parse an ISO8601 date/time with duration (wth start time). Eg. '2005-040/P1M'
Output Modifiers:
-s, --seconds
Show result as a seconds since 0000-001 00:00:00Z
-S, --epoch
Show result as a seconds since EPOCH (1970-001 00:00:00Z)
-L, --local
Show result as a 'local' date/time
-O, --ordinal
Show result as an 'ordinal' date/time
-W, --week
Show result as an 'calendar week' date/time
For more information on the ISO8601 standard, see: http://en.wikipedia.org/wiki/ISO_8601
AUTHOR
Written by Andrew Beekhof
REPORTING BUGS
Report bugs to pacemaker@oss.clusterlabs.org
Pacemaker 1.1.10-29.el7 June 2014 PACEMAKER(8)