Sponsored Content
Full Discussion: grep time and date
Top Forums Shell Programming and Scripting grep time and date Post 302151959 by ayhanne on Tuesday 18th of December 2007 05:03:56 AM
Old 12-18-2007
grep time and date

Hi,

I have a file which is a result of a script running every two minutes. What I wanted to do is to grep a specific date and time (hour and minute) from the file and then count the occurance of 201. I need to get the result of occurance of 201 every 5 minutes. What should I include in my command below to do that? I know I need to create variables for the date, just don't know how to do it. Thanks in advance! I hope someone can help me.

cat result.txt | nawk '{print $9}' | grep "201" | wc -l


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 17:59:54 20071217 17:59:59 201 103 630 aaaaaaaa60252750 bbbbbbbb0252750 0.0 -1 0.0 0 0

 

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
HDFLS(1)						      General Commands Manual							  HDFLS(1)

NAME
hdfls - list basic information about an HDF file SYNOPSIS
hdfls [-o] [-l] [-d] [-v] [-g] [-s] [-h] [-t n] hdf_file DESCRIPTION
hdfls provides general information about the tags, reference numbers, and if requested, lengths of the data elements. OPTIONS
-o display the reference numbers in ascending order. -l long format. Display more information about the file. -d Display offset and length information for each element in the file. -v verbose. Display annotation and label text, along with the format triggered by the -l flag. -g Group. List items by group. -s Special elements. Display detailed information about special elements. -d Display offset and length information for each element in the file. -h Dump DD block information. -t n Tag. Only list information about the specified tag. Must be followed by a tag number. EXAMPLES
A file called "aa.hdf" contains three items associated with a raster image; the image dimensions, a palette, and the raster image. To dis- play information about the contents of this file, the following command is used. hdfls aa.hdf The following output is displayed: aa.hdf: Image Dimensions-8: (Raster-8): (tag 200) Ref nos: 1 Image Palette-8: (Raster-8): (tag 201) Ref nos: 3 Raster Image-8: (Raster-8): (tag 202) Ref nos: 1 The following displays the same information with the length of each data element: hdfls -l aa.hdf This would result in the following information being displayed: aa.hdf: Image Dimensions-8: (Raster-8) : (tag 200) Ref no 1 4 bytes Image Palette-8: (Raster-8) : (tag 201) Ref no 3 768 bytes Raster Image-8: (Raster-8) : (tag 202) Ref no 1 120000 bytes SEE ALSO
hdf(5) October 31, 1999 HDFLS(1)
All times are GMT -4. The time now is 05:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy