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.

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

Try,

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

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...

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

But it dint work...

Kindly assist

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.

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

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

Somehow below one is also not working....

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

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

awk '/12345 version 1/' file
awk '/12345  version 2/' file
awk '/03:07:18/' file