Sponsored Content
Full Discussion: grep time and date
Top Forums Shell Programming and Scripting grep time and date Post 302152029 by ayhanne on Tuesday 18th of December 2007 09:37:59 AM
Old 12-18-2007
grep time and date

Hi Matrixmadhan,

It's you again and it's me again! Smilie I don't need a specific date and time. What I need to do is to count the number of occurance of 201 every interval of 5 minutes continously. The result.txt file is continously being appended by data like the sample below. I hope you can help me.


contents of result.txt:
Via NODE 4 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60232010 bbbbbbbb0232010 0.0 -1 0.0 0 0
Via NODE 0 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa99461665 bbbbbbbb65 0.0 -1 0.0 0 0
Via NODE 7 CP2 20071217 17:59:54 20071217 17:59:59 201 103 644 aaaaaaaa62179668 bbbbbbbb2179668 0.0 -1 0.0 0 0
Via NODE 7 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60239184 bbbbbbbb0239184 0.0 -1 0.0 0 0
Via NODE 0 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60230772 bbbbbbbb0230772 0.0 -1 0.0 0 0
Via NODE 2 CP2 20071217 18:01:54 20071217 17:59:59 201 103 630 aaaaaaaa60252750 bbbbbbbb0252750 0.0 -1 0.0 0 0
Via NODE 4 CP2 20071217 18:01:53 20071217 17:59:59 201 103 630 aaaaaaaa60232010 bbbbbbbb0232010 0.0 -1 0.0 0 0
Via NODE 0 CP2 20071217 18:02:53 20071217 17:59:59 201 103 630 aaaaaaaa99461665 bbbbbbbb65 0.0 -1 0.0 0 0
Via NODE 7 CP2 20071217 18:04 20071217 17:59:59 201 103 644 aaaaaaaa62179668 bbbbbbbb2179668 0.0 -1 0.0 0 0
Via NODE 7 CP2 20071217 18:05:53 20071217 17:59:59 201 103 630 aaaaaaaa60239184 bbbbbbbb0239184 0.0 -1 0.0 0 0
Via NODE 0 CP2 20071217 18:08:53 20071217 17:59:59 201 103 630 aaaaaaaa60230772 bbbbbbbb0230772 0.0 -1 0.0 0 0
Via NODE 2 CP2 20071217 18:09:54 20071217 17:59:59 201 103 630 aaaaaaaa60252750 bbbbbbbb0252750 0.0 -1 0.0 0 0



Hi Matrixmadhan,

It's you again and it's me again! Smilie I don't need a specific date and time. What I need to do is to count the number of occurance of 201 every interval of 5 minutes continously. The result.txt file is continously being appended by data like the sample below. I hope you can help me.


Code:
Via NODE 4 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60232010 bbbbbbbb0232010 0.0 -1 0.0 0 0 
Via NODE 0 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa99461665 bbbbbbbb65      0.0 -1 0.0 0 0 
Via NODE 7 CP2 20071217 17:59:54 20071217 17:59:59 201 103 644 aaaaaaaa62179668 bbbbbbbb2179668 0.0 -1 0.0 0 0 
Via NODE 7 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60239184 bbbbbbbb0239184 0.0 -1 0.0 0 0 
Via NODE 0 CP2 20071217 17:59:53 20071217 17:59:59 201 103 630 aaaaaaaa60230772 bbbbbbbb0230772 0.0 -1 0.0 0 0 
Via NODE 2 CP2 20071217 18:01:54 20071217 17:59:59 201 103 630 aaaaaaaa60252750 bbbbbbbb0252750 0.0 -1 0.0 0 0 
Via NODE 4 CP2 20071217 18:01:53 20071217 17:59:59 201 103 630 aaaaaaaa60232010 bbbbbbbb0232010 0.0 -1 0.0 0 0 
Via NODE 0 CP2 20071217 18:02:53 20071217 17:59:59 201 103 630 aaaaaaaa99461665 bbbbbbbb65      0.0 -1 0.0 0 0 
Via NODE 7 CP2 20071217 18:04 20071217 17:59:59 201 103 644 aaaaaaaa62179668 bbbbbbbb2179668 0.0 -1 0.0 0 0 
Via NODE 7 CP2 20071217 18:05:53 20071217 17:59:59 201 103 630 aaaaaaaa60239184 bbbbbbbb0239184 0.0 -1 0.0 0 0 
Via NODE 0 CP2 20071217 18:08:53 20071217 17:59:59 201 103 630 aaaaaaaa60230772 bbbbbbbb0230772 0.0 -1 0.0 0 0 
Via NODE 2 CP2 20071217 18:09:54 20071217 17:59:59 201 103 630 aaaaaaaa60252750 bbbbbbbb0252750 0.0 -1 0.0 0 0

Expected Output:

2007-12-18_17:59: to 18:04 201Count=301
2007-12-18_18:05: to 18:09 201Count=100
2007-12-18_18:10: to 18:14 201Count=798
and so on...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep to show date/time of file the string was found in.

I've seen several examples of grep showing the filename the string was found in, but what I really need is grep to show the file details in long format (like ls -l would). scenario is: grep mobile_number todays_files This will show me the string I'm after & which files they turn up in, but... (2 Replies)
Discussion started by: woodstock
2 Replies

2. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

3. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies

4. Shell Programming and Scripting

grep - date & time range

Hi, I need to search email files by date & time range in email files. The timezone is not important. Can someone plz advise how i can do this ? For e.g A user can specify only A single date A date range date & time range Below is part of the email file. (4 Replies)
Discussion started by: coolatt
4 Replies

5. Shell Programming and Scripting

Grep the Content of a LOG File which has latest Date and Time

Hi All, Need a small help. I have a log file which keeps updating for every Minute with multiple number of lines. I just want to grep few properties which has latest Date and Time to it. How do i do it? I wanted to grep a property by name "Reloading cache with a maximum of" from the... (4 Replies)
Discussion started by: nvindraneel
4 Replies

6. UNIX Desktop Questions & Answers

grep a range of time & date

how can i grep a range? i have a text file with the following text: result.log.00:2012/01/02 12:00:07.422 LOG STARTED HERE N6Kashya29MemoryShieldScheduler_AO_IMPLE, pid=8662/8658, config=(alertThreshold=10,alertLevel=0,killThreshold=7200,coreThreshold=0,full=1), deltaTime=0,... (1 Reply)
Discussion started by: boaz733
1 Replies

7. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

I have a cluster of two Solaris server (veritas cluster). one working and the other is standby I am going to change the date on them , and am looking for a secure solution as it is giving an important service. my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies

8. Shell Programming and Scripting

Adding time to date time in UNIX shell scipting

I needed some help in adding a duration (in seconds) to a start time (in hhmmss format) and a start date (in mmddyy format) in order to get an end date and end time. The concept of a leap year is also to be considered while incrementing the day. The code/ function that I have formed so far is as... (3 Replies)
Discussion started by: codehelp04
3 Replies

9. Shell Programming and Scripting

Displaying current date time of EDT in IST time

Hi Folks, My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST. IST time leads 9:30 mins to EDT. and i wrote something like below. ... (6 Replies)
Discussion started by: Showdown
6 Replies

10. UNIX for Dummies Questions & Answers

Does 'grep' update a file's access date/time?

I've got a job that finds and removes trace files based upon an access time of more than seven days (I've also tried a modify date). find TABC* -atime +7 -exec rm + find TABC* -mtime +7 -exec rm + Whether I use -atime or -mtime, the process seems to work sporadically. Sometimes it removes... (6 Replies)
Discussion started by: Scottie1954
6 Replies
WIKI-TOOLKIT-DELETE-NODE(1p)				User Contributed Perl Documentation			      WIKI-TOOLKIT-DELETE-NODE(1p)

NAME
wiki-toolkit-delete-node - Delete a node stored in a Wiki::Toolkit instance. SYNOPSIS
# Delete a node in a Wiki::Toolkit instance wiki-toolkit-delete-node --type postgres --name mywiki --user wiki --pass wiki --host 'db.example.com' --port 1234 --nodename MyNodeName wiki-toolkit-delete-node --type postgres --name mywiki --user wiki --pass wiki --host 'db.example.com' --port 1234 --id 2 --version 7 DESCRIPTION
Takes four mandatory arguments: type The database type. Should be one of 'postgres', 'mysql' and 'sqlite'. name The database name. nodename The name of the node to be deleted. id The id of the node to be deleted four optional arguments: user The user that connects to the database. It must have permission to create and drop tables in the database. pass The user's database password. host The hostname of the machine the database server is running on (omit for local databases). port The port number that the database server is expecting connections to. version The version number of the node to delete AUTHOR
Nick Burch COPYRIGHT
Copyright (C) 2006 Nick Burch. All Rights Reserved. This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Wiki::Toolkit perl v5.14.2 2011-09-25 WIKI-TOOLKIT-DELETE-NODE(1p)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy