LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-16-2015, 10:12 AM   #1
linuxew
LQ Newbie
 
Registered: Jan 2015
Posts: 21

Rep: Reputation: Disabled
Question grep for date and time


Hi all,
here is what my log files looks like:

[11/Nov/2015:06:35:00 -0500] x.59.x.x TLSv1 AES256-SHA "GET /TerminalLocationService/REST_v0_91/location?address=tel%3A%2B11506471471&accuracy=500&version=0.91 HTTP/1.1" 266 1901115
[11/Nov/2015:06:34:50 -0500] x.60.x.x TLSv1 AES256-SHA "GET /TerminalLocationService/REST_v0_91/location?address=tel%3A%2B1506471471&accuracy=500&version=0.91 HTTP/1.1" 267 12346003
[11/Nov/2015:06:35:00 -0500] x.59.x.x TLSv1 AES256-SHA "GET /TerminalLocationService/REST_v0_91/location?address=tel%3A%2B1506471471&accuracy=500&version=0.91 HTTP/1.1" 266 1881119


the file is a large file and sometimes I need to grep for specific time period, or specific time like 11/Nov/2015:19:30:00


can you please comment on combination of command I need to run.
thanks,
 
Old 11-16-2015, 10:22 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275
what about (for example):
grep 11.Nov.2015.15 filename
 
1 members found this post helpful.
Old 11-16-2015, 12:32 PM   #3
linuxew
LQ Newbie
 
Registered: Jan 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
what about (for example):
grep 11.Nov.2015.15 filename
thanks,seems it is working.

can you explain me how do we know to use "." instead of what I was using "11/Nov/2015:06:35" and not reciving any thing.
 
Old 11-16-2015, 01:43 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275Reputation: 7275
I do not know what did you use, but:
. means simply any char (can be a letter, number or anything else).
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Date comparison with 'string date having slashes and time zone' in Bash only TariqYousaf Programming 2 10-08-2009 07:37 AM
how to convert windows date and time to unix date and time jitupatil_2007 General 8 03-31-2008 05:58 AM
Setting system date and time affecting the clock and date on BIOS satimis Ubuntu 7 09-21-2007 08:02 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 07:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration