Sponsored Content
Top Forums Shell Programming and Scripting shell script to sort entries in a file by date and time Post 302501625 by ajiwww on Friday 4th of March 2011 04:34:40 AM
Old 03-04-2011
Code:
# cat test
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 09/30/11 11:80:82
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 05/22/11 06:22:45
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 11/32/11 33:92:99
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 02/11/11 04:11:22
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 01/01/10 02:00:10
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 02/02/10 04:01:11
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 07/29/11 08:44:77
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 03/12/11 05:12:33
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 04/21/11 06:20:40
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 10/31/11 11:91:95
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 08/30/11 08:66:80
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 06/28/11 07:40:65

DESIRED OUTPUT
Code:
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 01/01/10 02:00:10
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 02/02/10 04:01:11
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 02/11/11 04:11:22
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 03/12/11 05:12:33
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 04/21/11 06:20:40
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 05/22/11 06:22:45
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 06/28/11 07:40:65
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 07/29/11 08:44:77
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 08/30/11 08:66:80
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 09/30/11 11:80:82
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 10/31/11 11:91:95
6 dbclstr-b Logs Memphis_Prod_SQL_Diff Memphis-Prod-SQL-Inc-Application-Backup 11/32/11 33:92:99


Last edited by Franklin52; 03-04-2011 at 06:04 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute a part of shell script only after particular date and time

I have created a simple shell script... say test.sh Contents of test.sh ================ service named restart cp /etc/imp.conf /backup/test/ #-- if date > 15 July 2007 11:23 pm , then only issue the commans below, else exit --- cp /etc/secondimp.conf /backup/test/ rm -f... (2 Replies)
Discussion started by: fed.linuxgossip
2 Replies

2. Shell Programming and Scripting

Sort By Date and Time

Hi , I would like to list or sort by date and time (the files are named in day and time format) where the latest file will be placed at the bottom and the earliest file be placed at the top. Can anybody help me? My files are named in the following manner. EG: abc_071128_144121_data "... (21 Replies)
Discussion started by: Raynon
21 Replies

3. Shell Programming and Scripting

Is it possible to get the date and time of mail which we get into our inbox using shell script?

Hello All, I need a script which extarct the date and time of the mail which is there in our inbox... I can export the mail copy into desktop making it as a textfile or something like that.. So is there anyway to get the date and time from that? (3 Replies)
Discussion started by: smarty86
3 Replies

4. Shell Programming and Scripting

Date and Time comparison using shell script

Hi, I'm having two fields in the file F1|F2 20111220|102000 F1 ->YYYYMMDD F2 ->HHMMSS Now, I need to compare this with current date & time and need to return the difference value in hours. Already, I checked with datecalc from the forum. So, need hints from Shell Gurus. Thanks (10 Replies)
Discussion started by: buzzusa
10 Replies

5. Shell Programming and Scripting

How to Sort by Date and Time?

Hi, The input file is as follows, 22.06.2012 17:58:38 CPUser: xxxxxxx, billedAfterStatus: Active 13.07.2012 08:46:15 CPUser: xxxxxxx, billedAfterStatus: Active 20.07.2012 08:56:24 CPUser: xxxxxxx, billedAfterStatus: Active 20.03.2012 08:56:24 CPUser: xxxxxxx, billedAfterStatus: Active... (16 Replies)
Discussion started by: nanthagopal
16 Replies

6. Shell Programming and Scripting

How to do simple date (time) calculation in shell script?

Hi, I'm looking for a way to do a simple math calc during a shell script as a means of logging how long a particular task takes. For example... STARTTIME=whenever this script starts ./path/to/command.sh >>logfile.log TOTALTIME=<time at this stage of the script after above command... (7 Replies)
Discussion started by: nbsparks
7 Replies

7. Shell Programming and Scripting

Date / Time difference in shell script

================================================================================ Request ID GMDCOM TIME GMDRRS TIME COM-RRS ================================================================================ <36812974> Tue Oct 1 13:32:40 2013 Tue Oct 1 20:36:42 2013... (1 Reply)
Discussion started by: ghosh_tanmoy
1 Replies

8. Shell Programming and Scripting

Date / Time difference in shell script

Request ID GMDCOMTM GMDRRSTIME GMDRESTIME <36812986> : : :I want to display the date -time difference in other fields. Above I have given for only 1 record. I want to calculate for all the records. (GMCOMTM - GMDRRSTM) ,(GMDRRSTM-GMDRESTM) and... (5 Replies)
Discussion started by: ghosh_tanmoy
5 Replies

9. Shell Programming and Scripting

Date time difference in UNIX shell script

There are 2 dates, Tue Oct 1 13:40:19 2013 Sun Sept 30 10:26:23 2013 I have multiple dates like the above one. How do I calculate the date time difference and display in another column in Shell script. Please help. (3 Replies)
Discussion started by: tanmoysays
3 Replies

10. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies
Net::LDAP::Control::PostRead(3) 			User Contributed Perl Documentation			   Net::LDAP::Control::PostRead(3)

NAME
Net::LDAP::Control::PostRead - LDAPv3 Post-Read control object SYNOPSIS
use Net::LDAP; use Net::LDAP::Control::PostRead; use Net::LDAP::Constant qw( LDAP_CONTROL_POSTREAD LDAP_SUCCESS ); $ldap = Net::LDAP->new( "ldap.mydomain.eg" ); $postread = Net::LDAP::Control::PostRead->new( attrs => [ qw/givenName/ ] ); my $mesg = $ldap->modify( "cn=Barbara Jensen, o=University of Michigan, c=US", replace => { givenName => "Babs" }, control => $postread ); if ($mesg->code eq LDAP_SUCCESS) { my ($afterwards) = $mesg->control( LDAP_CONTROL_PREREAD ); my $entry = $afterwards ? $afterwards->entry() : undef; if ($entry) { print "givenName changed to '" . join("', '", $entry->get_value(givenName") . "' to 'Babs' "); } } DESCRIPTION
"Net::LDAP::Control::PostRead" provides an interface for the creation and manipulation of objects that represent the "Post-Read Controls" as described by RFC 4527. In modification operations, the "Post-Read request control" indicates to the server that a copy of the modified entry after the update is to be returned. After the successful completion of the operation, the accompanying "Post-Read response control" allows one to retrieve the updated value from the server's response. One use case of this control may be to obtain values of operational attributes, such as the "entryUUID" and "modifyTimestamp" attributes, updated by the server as part of the update operation. CONSTRUCTOR ARGUMENTS
In addition to the constructor arguments described in Net::LDAP::Control the following are provided. attrs => [ ATTR, ... ] A list of attributes to be returned in the entry returned in the response control. If absent, all attributes are returned. Operational attributes may be included in the list by explicitly asking for them or by using special "+" feature (provided the server supports this feature). METHODS
As with Net::LDAP::Control each constructor argument described above is also available as a method on the object which will return the current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument. In addition to these methods, the control also supports the following method: entry () Returns the entry from the response control in the response message to the LDAP request that contained the request control. The result is either a Net::LDAP::Entry object or undefined. SEE ALSO
Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc4527.txt AUTHOR
Peter Marschall <peter@adpm.de> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 2008,2011 Peter Marschall. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-07-21 Net::LDAP::Control::PostRead(3)
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy