Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Order based on timestamp in a single file Post 302758095 by prrampalli on Friday 18th of January 2013 12:25:22 PM
Old 01-18-2013
Hi Radoulov,

I have tried your updated query (changes names) and this is the output below

Code:
07:55:52.61_1_[20100623 07:55:52.61|DEBUG  |#000062|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593  
07:55:52.61_2_CRequestWrapper: Destructor - object 123456789 cleaned up
06:55:52.61_3_[20100621 06:55:52.61|INFO |#000051|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593 
06:55:52.61_4_CRequestWrapper: Destructor - object 123456789 cleaned up
08:55:52.61_5_[20100622 08:55:52.61|WARNING|#000055|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593 
08:55:52.61_6_CRequestWrapper: Destructor - object 123456789 cleaned up
08:55:52.61_7_awk -F\| '/^\[/ { 
08:55:52.61_8_  _1 = $1
08:55:52.61_9_  sub(/[^ ]+ */, x, _1)
08:55:52.61_10_  }
08:55:52.61_11_{ 
08:55:52.61_12_  print _1, NR, $0 
08:55:52.61_13_  }' OFS=_  /root/Desktop/abcd/*.* >>  123
08:55:52.61_14_awk -F\| '/^\[/ { 
08:55:52.61_15_  _1 = $1
08:55:52.61_16_  sub(/[^ ]+ */, x, _1)
08:55:52.61_17_  }
08:55:52.61_18_{ 
08:55:52.61_19_  print _1, NR, $0 
08:55:52.61_20_  }' OFS=_  /root/Desktop/test/*.* >>  123

But this is not what I was expecting. I need something which looks like this.

Code:
[20100621 06:55:52.61|INFO |#000051|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593 
CRequestWrapper: Destructor - object 123456789 cleaned up

[20100622 08:55:52.61|WARNING|#000055|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593 
CRequestWrapper: Destructor - object 123456789 cleaned up
 
[20100623 07:55:52.61|DEBUG  |#000062|test123 "GET /PowerBuilder/Compny3.htm HTTP/1.0" 200 5593  
CRequestWrapper: Destructor - object 123456789 cleaned up

This is what I wanted to see. See the change in dates. If the dates are same then I need the sorting based on timestamps in asc order.

Thank you

---------- Post updated at 10:55 PM ---------- Previous update was at 10:43 PM ----------

Hi Rbatte1,

I tried your query which throwed an error..

Code:
cut: the delimiter must be a single character
Try `cut --help' for more information.

Is it because of space? cut -d ' ' -f ?

Last edited by radoulov; 01-18-2013 at 04:07 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep in order based on the input file

Here is an answer rather than a question that I thought I would share. In my first attempt, I was using grep to find a list from file.1 within another file, file.2 which I then needed to paste the output from file.3 to file.1 in the same order. However, the results weren't what I wanted. At... (2 Replies)
Discussion started by: Kelam_Magnus
2 Replies

2. Shell Programming and Scripting

Purge files based on timestamp avl in file name

Dear All, I have the followoing requirement.. REQ-1: Suppose I have the following files XX_20070202000101.zip XX_20080223000101.zip XX_20080226000101.zip XX_20080227000101.zip XX_20080228000101.zip XX_20080229000101.zip Suppose sysdate = 29 Feb 2007 I need to delete all files... (3 Replies)
Discussion started by: sureshg_sampat
3 Replies

3. UNIX for Advanced & Expert Users

Copy lines from a log file based on timestamp

how to copy lines from a log file based on timestamp. INFO (RbrProcessFlifoEventSessionEJB.java:processFlight:274) - E_20080521_110754_967: rbrAciInfoObjects listing complete! INFO (RbrPnrProcessEventSessionEJB.java:processFlight:197) - Event Seq: 1647575217; Carrier: UA; Flt#: 0106; Origin:... (1 Reply)
Discussion started by: ranjiadmin
1 Replies

4. Shell Programming and Scripting

sort the files based on timestamp and execute sorted files in order

Hi I have a requirement like below I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory My files looks like this PGABOLTXML1D_201108121235.xml... (1 Reply)
Discussion started by: saidutta123
1 Replies

5. UNIX for Dummies Questions & Answers

Sorting files based on timestamp and picking the latest file

Hi Friends, Newbie to shell scripting Currently i have used the below to sort data based on filenames and datestamp $ printf '%s\n' *.dat* | sort -t. -k3,4 filename_1.dat.20120430.Z filename_2.dat.20120430.Z filename_3.dat.20120430.Z filename_1.dat.20120501.Z filename_2.dat.20120501.Z... (12 Replies)
Discussion started by: robertbrown624
12 Replies

6. Shell Programming and Scripting

File w/ many line pairs--how do I order based on 1st lines only?

I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence. I would like to sort the file by species name. Desired output for the example file: I can use sort -t'_' -k2 to alphabetize headers in the... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

7. UNIX for Dummies Questions & Answers

Display files based on particular file timestamp

Hi, I have requirement to list out files that are created after particular file. ex. I have below files in my directory. I want to display files created after /dirdat/CG1/cg004440 file. ./dirdat/CG1/cg004438 09/07/14 0:44:05 ./dirdat/CG1/cg004439 09/07/14 6:01:48 ... (3 Replies)
Discussion started by: tmalik79
3 Replies

8. Shell Programming and Scripting

Help with order lines from a file based on a pattern

Hi I need to order these lines from a txt file my file looks like this IMSI ........................ 1234567890 APN ......................... INTERNET.COM APN ......................... MMS.COM APN ......................... WAP.COM APN ......................... BA.COM IMSI... (4 Replies)
Discussion started by: alone77
4 Replies

9. Shell Programming and Scripting

Picking the latest file based on a timestamp for a Dynamic file name

Hi , I did the initial search but could not find what I was expecting for. 15606Always_9999999997_20160418.xml 15606Always_9999999998_20160418.xml 15606Always_9999999999_20160418.xml 9819Always_99999999900_20160418.xml 9819Always_99999999911_20160418.xmlAbove is the list of files I... (4 Replies)
Discussion started by: chillblue
4 Replies

10. UNIX for Beginners Questions & Answers

Filter records from a log file based on timestamp

Dear Experts, I have a log file that contains a timestamp, I would like to filter record from that file based on timestamp. For example refer below file - cat sample.txt Jan 19 20:51:48 mukul-Vostro-14-3468 systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)... (6 Replies)
Discussion started by: mukulverma2408
6 Replies
HTTP::OAI::Repository(3pm)				User Contributed Perl Documentation				HTTP::OAI::Repository(3pm)

NAME
HTTP::OAI::Repository - Documentation for building an OAI compliant repository using OAI-PERL DESCRIPTION
Using the OAI-PERL library in a repository context requires the user to build the OAI responses to be sent to OAI harvesters. SYNOPSIS 1 use HTTP::OAI::Harvester; use HTTP::OAI::Metadata::OAI_DC; use XML::SAX::Writer; use XML::LibXML; # (all of these options _must_ be supplied to comply with the OAI protocol) # (protocolVersion and responseDate both have sensible defaults) my $r = new HTTP::OAI::Identify( baseURL=>'http://yourhost/cgi/oai', adminEmail=>'youremail@yourhost', repositoryName=>'agoodname', requestURL=>self_url() ); # Include a description (an XML::LibXML Dom object) $r->description(new HTTP::OAI::Metadata(dom=>$dom)); my $r = HTTP::OAI::Record->new( header=>HTTP::OAI::Header->new( identifier=>'oai:myrepo:10', datestamp=>'2004-10-01' ), metadata=>HTTP::OAI::Metadata::OAI_DC->new( dc=>{title=>['Hello, World!'],description=>['My Record']} ) ); $r->about(HTTP::OAI::Metadata->new(dom=>$dom)); my $writer = XML::SAX::Writer->new(); $r->set_handler($writer); $r->generate; Building an OAI compliant repository The validation scripts included in this module provide the repository admin with a number of tools for helping with being OAI compliant, however they can not be exhaustive in themselves. METHODS
$r = HTTP::OAI::Repository::validate_request(%paramlist) $r = HTTP::OAI::Repository::validate_request_2_0(%paramlist) These functions, exported by the Repository module, validate an OAI request against the protocol requirements. Returns an HTTP::Response object, with the code set to 200 if the request is well-formed, or an error code and the message set. e.g: my $r = validate_request(%paramlist); print header(-status=>$r->code.' '.$r->message), $r->error_as_HTML; Note that validate_request attempts to be as strict to the Protocol as possible. $b = HTTP::OAI::Repository::validate_date($date) $b = HTTP::OAI::Repository::validate_metadataPrefix($mdp) $b = HTTP::OAI::Repository::validate_responseDate($date) $b = HTTP::OAI::Repository::validate_setSpec($set) These functions, exported by the Repository module, validate the given type of OAI data. Returns true if the given value is sane, false otherwise. EXAMPLE
See the bin/gateway.pl for an example implementation (it's actually for creating a static repository gateway, but you get the idea!). perl v5.12.4 2010-09-01 HTTP::OAI::Repository(3pm)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy