Grep content between timestamp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep content between timestamp
# 1  
Old 09-29-2010
Grep content between timestamp

Hi all,

I have a file which will be updated every half an hour and time stamp will be printed in the beginning of the updation. i just want to grep the content between every hoalf an hour.

Pls help me on this issue. how to grep contents between tim stamp?


Ex of file:

Code:
29/09/2010 00:30
callingPtyConvE 0       0       0       0      
cpartyId        0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
objectClass     0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
cpartyName      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
entryACI        0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
dibAttributeTyp 0       0       0       0      
configType      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
objectClass     0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
dibAttrTypeEntr 0       0       0       0      
attributeId     0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
objectClass     0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
attributeName   0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
syntaxType      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
location        0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
singleValue     0       0       0       0       0       0       0       0       0       0       0       0       0       0       0   
    0      
userAttr        0       0       0       0       0       0       0       0       0       0       0       0       0       0       0 

29/09/2010 01:00

cpartyName      0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
entryACI        0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
dibAttributeTyp 0       0       0       0      
configType      0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
objectClass     0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
dibAttrTypeEntr 0       0       0       0      
attributeId     0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
objectClass     0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
attributeName   0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
syntaxType      0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
location        0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
singleValue     0       0       0       0       0       0       0        0       0       0       0       0       0       0       0   
    0      
userAttr        0       0       0       0       0       0       0        0       0       0       0       0       0       0       0


Thanks

Steve
# 2  
Old 09-29-2010
Code:
awk '/29\/09\/2010 01:00/,/userAttr/' infile

# 3  
Old 09-29-2010
Hi rdcwayx,

I want to take the output for every half an hour .. and i want to put script in crontab also.. i'm using solaris system.

Pls help !!

Thanks

Steve
# 4  
Old 09-29-2010
not clear.

From your sample , I don't know what output you need to get every half an hour.
# 5  
Old 09-29-2010
Hi,

I mean .. i want to take the content between the timestamp of every half an hour and put it into new file.

Hope u understand.

Thanks

Steve
# 6  
Old 09-29-2010
I am a little understand your expect now.

For example, the cornjob running at 29/09/2010 00:40, then you need capture the data in 29/09/2010 00:30 block. Because at that time, 01:00 data are still not ready.

Is that correct?
# 7  
Old 09-29-2010
Exactly ... but i want to grep the content between 00:00 to 00:30 hours...
next 00:30 to 01:00
01:00 to 01:30
01:30 to 02:00 etc...

you are correct !!

Pls help !!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies

2. Shell Programming and Scripting

Append timestamp create .trg file for all content of an unzipped archive

Hi, I have a test.zip archive that contains test.zip --> (file_1.txt, file_2.txt , file_3.txt) I need to unzip the file like this, file_1_timestamp.txt file_1_timestamp.trg file_2_timestamp.txt file_2_timestamp.trg file_3_timestamp.txt file_3_timestamp.trg Could you please let me know... (7 Replies)
Discussion started by: Shandel
7 Replies

3. UNIX for Dummies Questions & Answers

Grep content in xml file

I have an xml file with header as below. <Provider xmlns="http://www.xyzx.gov/xyz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyzx.gov/xyz xyz.xsd" SCHEMA_VERSION="2.5" PROVIDER="5"> I want to get the schema version here that is 2.5 and put in a... (7 Replies)
Discussion started by: Ariean
7 Replies

4. Shell Programming and Scripting

How to sort grep result based on timestamp?

Hi, Trying to sort grep result based on timestamp of the filename. I have the following result and want to sort them on timestampgrep -i 'ERROR' *log*2013* s_m_xxx_xxx_xxx_xxx_xxxx.log.20130906092431:TRANSF_1_1_1> DBG_21216 Finished transformations for Source Qualifier . Total errors ... (5 Replies)
Discussion started by: bobbygsk
5 Replies

5. Shell Programming and Scripting

How to grep the content performed by an User

I want to grep the content performed by an User from a file. Suppose that i have a following file HYD-HMS-2$ ls -lrt -rw-r--r-- 1 sdfrun sdf 31726356 Aug 1 13:04 journal.03.01082012.19.csv I could able to grep the content performed by a user by "sed" command as follows HYD-HMS-2$... (0 Replies)
Discussion started by: duppalav
0 Replies

6. Shell Programming and Scripting

how to get tags content by grep

1) Is it possible to get tags content by grep -E ? For example title. Source text "<title>My page<title>"; to print "My page". 2) which bash utility to use when I want to use regex in this format? (?<=title>).*(?=</title) (11 Replies)
Discussion started by: visitor123
11 Replies

7. UNIX for Dummies Questions & Answers

Append file with grep output but add timestamp?

I've setup a cron job that greps a file every five minutes and then writes (appends) the grep output/result to another file: grep "monkey" zoo.log | tail -1 >> cron-zoo-log Is there any way I can add the date and time (timestamp) to the cron-zoo-log file for each time a new line was added? ... (12 Replies)
Discussion started by: Sepia
12 Replies

8. AIX

how to grep and compare timestamp in a file with the current date

I want to read a log file from a particular location.In the log file each line starts with timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file... (1 Reply)
Discussion started by: achu
1 Replies

9. AIX

how to grep and compare timestamp in a file with the current date

I want to read a log file from a particular location.In the logfile , lines contains timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file format.Please... (1 Reply)
Discussion started by: achu
1 Replies

10. Shell Programming and Scripting

how to grep the logs for two particular timestamp

Hi, could anyone help me out how to write a script, to grep the two timestamp from a particular file, so that it will list out all the logs between the particular timestamp I have a pattern of log: servicename operationname starttime endtime eg., servicename1 operationname1 01:11:11... (1 Reply)
Discussion started by: jacktolearn
1 Replies
Login or Register to Ask a Question