02-28-2009
Quote:
Originally Posted by
fed.linuxgossip
Hi,
time stamp format is:
2009-02-28 21:55:01
Well, there you are. Just compare the current datetime with that value converted to a datetime, and there you go.
What languages do you know? Bash script, korn shell script, Perl, Python? Whichever you use, a one-second Google search will tell you how to convert a string to a datetime, and another one-second Google search will tell you how to compare two datetimes.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello
have a file1
H87I
Y788O
T347U
J23U
and
file2 J23U U887Y I99U T556U
file3 I99O J99T F557J
file4 N99I T666U R55Y
file5 H87I T347U
file6 H77U R556Y E44T
file7 Y788O K98U H8I
May be using script we can use file1 to search for all the files
and have the output
H87I file5... (3 Replies)
Discussion started by: cdfd123
3 Replies
2. Shell Programming and Scripting
Hello,
I have a file which has user information. Each user has 2 variables with the same name like
Email: testuser1
Email: testuser1@test.com
Email: testuser2
Email: testuser2@test.com
My intention is to delete the ones without the '@' symbol. When I run this statement awk '/^Email:/&&!/@/'... (6 Replies)
Discussion started by: rmsagar
6 Replies
3. Shell Programming and Scripting
Hi,
can someone help me.
I have some files and search a content in this files. If i have a hit I will print a output:
filename:content
But are more hits in one file: The output is always filename:content
E.G. Seach about "three"
file1 {one, two, three, four, three}
file2... (5 Replies)
Discussion started by: Timmää
5 Replies
4. Shell Programming and Scripting
AT
----------
0
Elapsed: 00:00:00.02
SO
----------
0
Elapsed: 00:00:00.01
SE
----------
0
Elapsed: 00:00:00.01
CR
---------- (4 Replies)
Discussion started by: sandy1028
4 Replies
5. Shell Programming and Scripting
Hi,
Need help in writing a script to read the contents of this file test
Test
00a
00b
00c
00d
00e
00f
where it need to read each line to give a display such as
form meta from dev 00a , config=Striped; add dev 00b:00f to meta 00a
Can any one help me in writing this script (2 Replies)
Discussion started by: praveen1516
2 Replies
6. UNIX for Dummies Questions & Answers
I have a file called po.txt. Here is the content of the file:
<!DOCTYPE PurchaseOrderMessage (View Source for full doctype...)>
- <PurchaseOrder>
- <Header>
<MessageId>cdb3062b-685b-4cd5-9633-013186750e10</MessageId>
<Timestamp>2011-08-01T13:47:23.536-04:00</Timestamp>
</Header>
-... (4 Replies)
Discussion started by: webbi
4 Replies
7. Shell Programming and Scripting
Hi Friends,
This is the only solution to my task. So, any help is highly appreciated.
I have a file
cat input1.bed
chr1 100 200 abc
chr1 120 300 def
chr1 145 226 ghi
chr2 567 600 unix
Now, I have another file by name
input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies
8. Shell Programming and Scripting
The file f1 contains the text "body" (shell prompt is "$"):
$ cat ~/path/f1
body
How to print contents of f1 when the f1 path is in a variable?
Here is my failed attempt:
$ f1="~/path/f1"
$ echo $f1
~/path/f1
$ cat $f1
cat: '~/path/f1': No such file or directory (2 Replies)
Discussion started by: wolfv
2 Replies
9. UNIX for Beginners Questions & Answers
Trying to use sed to insert the contents of a file into the end of each line in another file
file1
This is a line
Here is another line
This is yet another line
Here is a fourth line
file2
TEXT
desired output
This is a line TEXT
Here is another line TEXT
This is yet another... (6 Replies)
Discussion started by: jimmyf
6 Replies
10. UNIX for Beginners Questions & Answers
I need to find a file and print its contents
I am trying but it is not working
find -path /opt/app-root/src/.npm/_logs -type f -name "*.log" -print
Version
$ bash -version
GNU bash, version 4.4.12(1)-release (x86_64-pc-msys) (1 Reply)
Discussion started by: SVRao19056
1 Replies
LEARN ABOUT DEBIAN
atompub::datetime
Atompub::DateTime(3pm) User Contributed Perl Documentation Atompub::DateTime(3pm)
NAME
Atompub::DateTime - A date and time object for the Atom Publishing Protocol
SYNOPSIS
# assuming the local timezone is JST (+09:00)
use Atompub::DateTime qw(datetime);
$dt = datetime; # current time
$dt = datetime(DateTime->new);
$dt = datetime(1167609600); # UTC epoch value
$dt = datetime('20070101090000');
$dt = datetime('2007-01-01 09:00:00');
$dt = datetime('2007-01-01 00:00:00Z');
$dt = datetime('2007-01-01T09:00:00+09:00');
$dt = datetime('2007-01-01T00:00:00Z');
$dt = datetime('Mon, 01 Jan 2007 00:00:00 GMT');
$dt->epoch; # 1167609600 (UTC epoch value)
$dt->iso; # 2007-01-01 09:00:00 (in localtime)
$dt->isoz; # 2007-01-01 00:00:00Z
$dt->w3c; # 2007-01-01T09:00:00+09:00
$dt->w3cz; # 2007-01-01T00:00:00Z
$dt->str; # Mon, 01 Jan 2007 00:00:00 GMT
my $dt2 = datetime($dt); # copy
$dt == $dt2; # compare
"$dt"; # $dt->w3c
$dt->dt; # DateTime object
METHODS
Atompub::DateTime->new([ $str ])
Returns a datetime object representing the time $str. If the function is called without an argument, it will use the current time.
datetime([ $str ])
An alias for Atompub::DateTime->new
$datetime->epoch
Returns UTC epoch value.
1167609600
$datetime->iso
Returns a "YYYY-MM-DD hh:mm:ss"-formatted string representing time in the local time zone.
2007-01-01 09:00:00
$datetime->isoz
Returns a "YYYY-MM-DD hh:mm:ssZ"-formatted string representing Universal Time.
2007-01-01 00:00:00Z
$datetime->w3c
Returns a "YYYY-MM-DDThh:mm:ssTZ"-formatted string (W3C DateTime Format) representing time in the local time zone.
2007-01-01T09:00:00+09:00
$datetime->w3cz
Returns a "YYYY-MM-DDThh:mm:ssZ"-formatted string (W3C DateTime Format) representing Universal Time.
2007-01-01T00:00:00Z
$datetime->str
Returns a human readable representation.
Mon, 01 Jan 2007 00:00:00 GMT
$datetime->dt
An accessor for the internal DateTime object.
$datetime->tz
An accessor for the internal DateTime::TimeZone object.
$datetime->fmt
An accessor for the internal DateTime::Format object.
INTERNAL INTERFACES
$datetime->init
$datetime->_parse_timestamp
SEE ALSO
Atompub
AUTHOR
Takeru INOUE, <takeru.inoue _ gmail.com>
LICENCE AND COPYRIGHT
Copyright (c) 2007, Takeru INOUE "<takeru.inoue _ gmail.com>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
perl v5.14.2 2011-04-30 Atompub::DateTime(3pm)