The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Grepping issue.. LinuxRacr Shell Programming and Scripting 9 02-28-2008 12:26 PM
grepping around cbeauty Shell Programming and Scripting 9 08-29-2007 02:56 AM
Grepping for strings t4st33@mac.com UNIX for Dummies Questions & Answers 5 06-21-2007 12:51 AM
grepping for a sentence eloquent99 UNIX for Dummies Questions & Answers 2 04-23-2003 03:40 PM
grepping eloquent99 UNIX for Dummies Questions & Answers 5 04-22-2003 11:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 1.00 average. Display Modes
  #1 (permalink)  
Old 11-12-2004
fusion99 fusion99 is offline
Registered User
  
 

Join Date: Jan 2004
Posts: 7
grepping for numbers in between

Ok here's the situation I have a log like the following:

(S0) Time: 124937.326033 - SendingTime: '20041108-12:49:29'
(S0) Time: 124937.389946 - SendingTime: '20041108-12:49:29'
(S0) Time: 124937.462494 - SendingTime: '20041108-12:49:29'
(S0) Time: 124937.551056 - SendingTime: '20041108-12:49:29'
(S0) Time: 124937.617128 - SendingTime: '20041108-12:49:29'
(S0) Time: 124937.689085 - SendingTime: '20041108-12:49:29'


I can have a few thousand lines like this in a log. How can I grep according to the time using the the numbers after "Time:" or after the date. Like if I want to grep out everything between 10:30 to 1:30

Any info you can spare would be much appreciated ..

thanks in advance
  #2 (permalink)  
Old 11-12-2004
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
Try the following ... pass lowervalue and upper value as command line args.

script 12 14 will give times between 12:30 and 14:30
file1 is the file having data.

code:
-----------------------------------------

lowerlimit=$13000
upperlimit=$23000

while read line
do
patt=`echo $line | cut -d" " -f 3 | cut -d"\." -f 1`


if test $patt -ge $lowerlimit -a $patt -le $upperlimit
then
echo $line ;
fi

done < file1


---------------------------------------------------- ----
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0