Generate tabular data based on a column value from an existing data file
Hi,
I have a data file with :
I need to find the first occurring date and the last occurring date for a particular value in column 4 for each combination of column 2 and 3
For example the output from above data should be:
because the value (column 4)=98955 for (column 2)=1 and (column 3)=1 first occurs on date 01/28/2012 and last occurs on date 01/29/2012, after which on 01/30/2012 it changes to 98896,so a new row is added.When a value is the last value in the file, the last occurance date is 99/99/9999.
Not sure whether i could make it clear but is unix shell scripting(with awk maybe) the best way to achieve this or does this need something like perl ?
Last edited by Franklin52; 01-18-2013 at 04:01 AM..
Reason: Please use code tags for data and code samples
Hi,
Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent.
E.g : username empid
------------------------
sri 123
to
username,empid
sri,123
Thanks,
Hema:confused: (2 Replies)
Hi all,
I need help to add additional data from file2 to existing data in file 1 using awk, sed or perl. the ID in file 1 should match against field $3 in file2
file1
#this is a new game
ID HR_1
BASE1 30
BASE2 37
DETAIL No
TYPE L
@@
ID HR_10
BASE1 6030
BASE2 ... (4 Replies)
Hi All,
I need to develop a shell script which does sanity check of a data file, as below.
1. For DATE columns, it should check if date is given in proper format or not? For example, if format of date is expected as DD-MON-YYYY HH24:MI:SS and we received the date in formation like DDMMYYYY HH24,... (1 Reply)
Hi All
I need to add a column on my existing data file. I know similar posts are there but none of them were meeting my requirement. My input is
1.20 3.44 4.88
5.11 4.99 3.22
1.89 3.89 2.90
Desired output
1 1.20 3.44 4.88
2 5.11 4.99 3.22
3 1.89 3.89 2.90
I will... (2 Replies)
Hi all,
I am new to shell script.I need your help to write a shell script.
I need to write a shell script to extract data from a .csv file where columns are ',' separated.
The file has 5 columns having values say column 1,column 2.....column 5 as below along with their valuesm.... (3 Replies)
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Hi,
I have a file pk.txt which has pk data in following format
TableName | PK
Employee | id
Contact|name,country
My Output should be
Employee | t1.id=s.id
Contact| t1.name=s.name AND t1.country=s.country
I started of like this:
for LIST in `cat pk.txt` do... (5 Replies)
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
LEARN ABOUT DEBIAN
moosex::types::iso8601
MooseX::Types::ISO8601(3pm) User Contributed Perl Documentation MooseX::Types::ISO8601(3pm)NAME
MooseX::Types::ISO8601 - ISO8601 date and duration string type constraints and coercions for Moose
SYNOPSIS
use MooseX::Types::ISO8601 qw/
ISO8601TimeDurationStr
/;
has duration => (
isa => ISO8601TimeDurationStr,
is => 'ro',
coerce => 1,
);
Class->new( duration => 60 ); # 60s => PT00H01M00S
Class->new( duration => DateTime::Duration->new(%args) )
DESCRIPTION
This module packages several TypeConstraints with coercions for working with ISO8601 date strings and the DateTime suite of objects.
DATE CONSTRAINTS
ISO8601DateStr
An ISO8601 date string. E.g. "2009-06-11"
ISO8601TimeStr
An ISO8601 time string. E.g. "12:06:34Z"
ISO8601DateTimeStr
An ISO8601 combined datetime string. E.g. "2009-06-11T12:06:34Z"
ISO8601DateTimeTZStr
An ISO8601 combined datetime string with a fully specified timezone. E.g. "2009-06-11T12:06:34+00:00"
COERCIONS
The date types will coerce from:
" Num "
The number is treated as a time in seconds since the unix epoch
" DateTime "
The duration represented as a DateTime object.
" Str "
Non-expanded date and time string representations.
e.g.:-
20120113 => 2012-01-13 170500Z => 17:05:00Z 20120113T170500Z => 2012-01-13T17:05:00Z
Representations of UTC time zone (only an offset of zero is supported)
e.g.:-
17:05:00+00:00 => 17:05:00Z 17:05:00+00 => 17:05:00Z 170500+0000 => 17:05:00Z
2012-01-13T17:05:00+00:00 => 2012-01-13T17:05:00Z 2012-01-13T17:05:00+00 => 2012-01-13T17:05:00Z 20120113T170500+0000 =>
2012-01-13T17:05:00Z
Also supports non-standards mixing of expanded and non-expanded representations
e.g.:-
2012-01-13T170500Z => 2012-01-13T17:05:00Z 20120113T17:05:00Z => 2012-01-13T17:05:00Z
DURATION CONSTRAINTS
ISO8601DateDurationStr
An ISO8601 date duration string. E.g. "P01Y01M01D"
ISO8601TimeDurationStr
An ISO8601 time duration string. E.g. "PT01H01M01S"
ISO8601DateTimeDurationStr
An ISO8601 comboined date and time duration string. E.g. "P01Y01M01DT01H01M01S"
COERCIONS
The duration types will coerce from:
" Num "
The number is treated as a time in seconds
" DateTime::Duration "
The duration represented as a DateTime::Duration object.
The duration types will coerce to:
" Duration "
A DateTime::Duration, i.e. the " Duration " constraint from MooseX::Types::DateTime.
SEE ALSO
o MooseX::Types::DateTime
o DateTime
o DateTime::Duration
o DateTime::Format::Duration
VERSION CONTROL
http://github.com/bobtfish/moosex-types-iso8601/tree/master
Patches are welcome.
SEE ALSO
o http://en.wikipedia.org/wiki/ISO_8601
o http://dotat.at/tmp/ISO_8601-2004_E.pdf
FEATURES
Fractional seconds
If provided, the number of seconds in time types is represented to microsecond accuracy. A full stop character is used as the decimal
seperator, which is allowed, but deprecated in preference to the comma character in ISO 8601:2004.
BUGS
Probably full of them, patches are very welcome.
Specifically missing features:
o No timezone support - all times are assumed UTC
o No week number type
o "Basic format", which lacks seperator characters, is not supported for reading or writing.
o Tests are rubbish.
AUTHOR
Tomas Doran (t0m) "<bobtfish@bobtfish.net>"
Dave Lambley "<davel@state51.co.uk>"
The development of this code was sponsored by my employer <http://www.state51.co.uk>.
Contributors
Aaron Moses
COPYRIGHT
Copyright (c) 2009 Tomas Doran. Some rights reserved.
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-05-11 MooseX::Types::ISO8601(3pm)