|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Grep Logs That Are Updating
Hello all. I am new to this forum and also very new to using grep - so please excuse me if this question is not in the correct forum and/or is not pertinent to this website. I use greps like this: Code:
gunzip -c L:\System1\SailLogger_20071019* L:\System2\SailLogger_20071019* L:\System3\SailLogger_20071019* | grep 35=Order These logs are updating continuosly throughout the day. SailLogger_20071019* is the name of log followed by YYYYMMDD. I use the wildcard to target all the logs (the logs themselves are renamed at the top of each hour - eg 2007101907 (for 7am) and 2007101908 (for 9am). When I run this grep, it will only extract from the first log in the statement - System1. I then get an error message related to not being able to find the end of the file. Is there a way to grep all these logs ? Thanks you for any help and guidance. Regards.
Last edited by bakunin; 01-30-2013 at 10:40 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
It is very strange and unusual for a gzipped log to be continually appended to. Are you sure all of these logs are already compressed?
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Hi Thanks for replying. Yes these logs are updating every 30 seconds. I tried this grep -
gunzip -c L:\System1\SailLogger_20130118* L:\System2\SailLogger_20130118* L:\System3\S ailLogger_20130118* | grep 35=SailErrorNotice and got results for System1 logs but then received this message - gunzip: L:\System1\SailLogger_2013011813.tlg.gz: unexpected end of file And in case it matters, I am running these greps in a windows environment. |
|
#4
|
|||
|
|||
|
I just noticed that you're unzipping the same thing three times in a row: Code:
L:\System1\SailLogger_20130118* L:\System2\SailLogger_20130118* L:\System3\SailLogger_20130118* Is that really intentional? Didn't you want three different logfiles? |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Hi. Yes. Each path has a differnt log (System1,2,3) that follows the same naming convention.
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Do you know about the
zgrep command (cf. man zgrep):
Quote:
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Pardon my blind eyes, I don't know how I missed that. Anyway. If this code is for a real shell and not windows cmd, I'd try this: Code:
for FILE in L:\System1\SailLogger_20130118* L:\System2\SailLogger_20130118* L:\System3\SailLogger_20130118*
do
gunzip < "$FILE"
done | grep 35=SailErrorNotice |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to check whether logs are updating or not? | mail2sant | Shell Programming and Scripting | 1 | 11-30-2009 12:46 AM |
| how to grep the logs for two particular timestamp | jacktolearn | Shell Programming and Scripting | 1 | 04-18-2009 09:31 PM |
| Grep yesterday logs from weblogic logs | harish.parker | Shell Programming and Scripting | 3 | 11-04-2008 08:00 AM |
| Grep logs on the fly | harperonline | Shell Programming and Scripting | 3 | 05-12-2008 09:32 PM |
| Constantly updating log files (tail -f? grep? awk?) | nortonloaf | UNIX for Dummies Questions & Answers | 0 | 12-03-2006 10:20 PM |
|
|