grep numbers range | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

grep numbers range

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-08-2005
azmathshaikh azmathshaikh is offline
Registered User
 
Join Date: Mar 2005
Last Activity: 13 April 2008, 6:37 AM EDT
Location: Hyderabad, India
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
grep numbers range

I want to grep a range of numbers in a log file. My log file looks like this:

20050807070609Z;blah blah
That is a combination of yr,month,date,hours,minutes,seconds.
I want to search in the log file events that happened between a particular time.
like between 20050807070000 to 20050822070000 i.i all events happened between 7thAugust 7am until 22nd August 7am.

I tried with grep but in vain.

Help

Thanks
Sponsored Links
    #2  
Old 08-08-2005
vino's Avatar
vino vino is offline Forum Advisor  
Supporter (in vino veritas)
 
Join Date: Feb 2005
Last Activity: 9 April 2013, 8:19 AM EDT
Location: Sydney, Down Under
Posts: 2,847
Thanks: 0
Thanked 12 Times in 12 Posts
Use sed.

Assuming you have the start date and end date,

sed -n -e '/20050807070000/,/20050822070000/p' log.file

Vino
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Range of numbers in HEX using AWK greycells Shell Programming and Scripting 2 10-07-2011 10:44 AM
grep for a range of numbers tamil.pamaran Shell Programming and Scripting 4 09-21-2011 05:34 PM
Frequency of a range of numbers Gussifinknottle UNIX for Dummies Questions & Answers 1 01-26-2011 03:49 PM
read numbers from file and output which numbers belongs to which range thepurple Shell Programming and Scripting 6 05-13-2009 06:07 AM
Using grep on a range of numbers ProgChick2oo9 UNIX for Dummies Questions & Answers 1 03-15-2009 03:58 PM



All times are GMT -4. The time now is 04:37 AM.