Limited log on specific timelines


 
Thread Tools Search this Thread
Operating Systems Linux Limited log on specific timelines
# 1  
Old 05-15-2015
Limited log on specific timelines

Hi Gurus,

We have a very huge size log files (around 3-4 GBs), in which all the versions (nothing but a log entries) of orders would be saved... It is very hard to find out the exact piece of log for a specific order (by moving the cursor or by searching with specific key words in vi).

I know the timelines of the order and the log file also will be having the time entry at the start of each line like below.


Quote:
08:21:39.166 ^ INFO ^ DefaultWorkManage
08:21:39.167 ^ INFO ^ DefaultWorkManage
08:21:39.167 ^ INFO ^ DefaultWorkManage
08:23:02.348 ^ INFO ^ WebContainer : 15
08:23:02.403 ^ INFO ^ WebContainer : 15
08:23:02.405 ^ INFO ^ WebContainer : 15
08:23:18.832 ^ INFO ^ WebContainer : 15
08:23:18.834 ^ INFO ^ WebContainer : 15
08:23:18.837 ^ INFO ^ WebContainer : 15
08:23:18.850 ^ INFO ^ WebContainer : 15
08:23:18.850 ^ INFO ^ WebContainer : 15
08:23:18.850 ^ INFO ^ WebContainer : 15
I want to grep the lines that are logged between a specific timelines...
For ex: From "08:21:39" to "08:30:00"

Can someone help me with the exact awk/grep options to grep the lines based on time zones..

Thanks for help in advance.

Regards,
VRN
# 2  
Old 05-15-2015
Try,

Code:
awk '/08:21:39/,/08:30:00/ {print}' file

This User Gave Thanks to clx For This Post:
# 3  
Old 05-19-2015
Thanks much for the reply.

Its working... but could you let me know the way for searching the keawords in same way... For Ex: I want to find out all the logs between two specific keywords...

Code:
awk '/'12345 version 1'/,/'12345  version 2'/ {print }' file

But it dint work...

Kindly assist
# 4  
Old 05-19-2015
Too many ' in there. Just keep the outermost ones.

---------- Post updated at 14:38 ---------- Previous update was at 14:37 ----------

And, make sure both strings exist and second comes after first.
# 5  
Old 05-20-2015
Code:
awk '/12345 version 1/,/12345  version 2/ {print }' file

I tried above, it didnt work.....

Somehow below one is also not working....

Code:
awk '/03:05:37/,/03:07:18/ {print }' file

It is taking the first value correctly and fetching the data from "03:05:37", but it is not taking the second value and giving result till end of file.

Can someone advice on above pls?

Regards,
VRN

Last edited by hi.villinda; 05-20-2015 at 01:35 AM..
# 6  
Old 05-20-2015
Do those strings exist LITERALLY in the input file? I can see version 2 has two separating spaces vs. one in version 1 's case.
Please post the result of
Code:
awk '/12345 version 1/' file
awk '/12345  version 2/' file
awk '/03:07:18/' file

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ICMP for limited time

Hi, I am using following command: tcpdump -i eth1 icmp =8 >output.txt i want this command to get execute for a minute only. How can we do this? Thanks. Please use code tags next time for your code and data. Thanks (2 Replies)
Discussion started by: Satyajeet@uh
2 Replies

2. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

3. Homework & Coursework Questions

Listing limited no. of files

Hi, If there are 20 files in current directory ,How display the long listing of files in that directory with listing of four files at once.. (3 Replies)
Discussion started by: Phaneendra G
3 Replies

4. UNIX for Advanced & Expert Users

new userid with limited access

Hi, I want to create a user using useradd -m test. But my requirement is he should not change his directory from Home directory. How can I restric the user not to change his directory from his home dir? Thanks, Suresh Double Post (0 Replies)
Discussion started by: suresh3566
0 Replies

5. UNIX for Dummies Questions & Answers

Extract Data and arrange it based on timelines

Hi Im trying to extract a specific pattern of data from a log file and store it in a other file, Im executing the below command in various files and storing it in a single file. I data that Im storing needs to be arranged based on a date and timestamp. Please assist, how to achieve this. Thanks... (1 Reply)
Discussion started by: vr3w3c9
1 Replies

6. Shell Programming and Scripting

Run the UNIX script only in specified timelines

Hi, I have an UNIX script which runs in every 20 mins of all the days scheduled through CRON. But i need to modify the CRON entry such that it should run from 00:00 AM to 18:00 and again from 22:30 to 23:59 on Saturday. Remaning days, it should run as usual in every 20 mins. Could anybody... (1 Reply)
Discussion started by: rjanardhan83
1 Replies

7. Shell Programming and Scripting

Run the UNIX script only in specified timelines

Hi, I have an UNIX script which runs in every 20 mins of all the days scheduled through CRON. But i need to modify the CRON entry such that it should run from 00:00 AM to 18:00 and again from 22:00 to 23:59 on Saturday. Remaning days, it should run as usual in every 20 mins. Could... (1 Reply)
Discussion started by: rjanardhan83
1 Replies

8. UNIX for Dummies Questions & Answers

user with limited access

dear guys, sorry for asking a noob :p question, tried to search the forum for an answer but couldn't find one, i am running solaris 10 and i would like to create a user with limited access to view only one directory, the directory already exist, is this possible:confused:? thanks and regards (4 Replies)
Discussion started by: q8devilish
4 Replies

9. Solaris

user with limited privileges

Hi, I tried to search, but could not find answer for this really: Is it possible to create a user that would have access only to a defined list of files? I would like to create a user that can access a set of files that are located behind different path. This user should not have access to... (1 Reply)
Discussion started by: Juha
1 Replies
Login or Register to Ask a Question

Featured Tech Videos