![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OpenOffice.org 3.0 is an incremental improvement | iBot | UNIX and Linux RSS News | 0 | 10-13-2008 11:10 AM |
| New GNOME 2.24 is an incremental improvement | iBot | UNIX and Linux RSS News | 0 | 09-29-2008 11:10 AM |
| The CCP1GUI: New incremental release | iBot | Software Releases - RSS News | 0 | 01-08-2008 08:00 PM |
| rsync incremental question | zhivko.neychev | UNIX for Advanced & Expert Users | 7 | 05-31-2007 11:33 AM |
| tar - incremental backup | Funky_ass | Shell Programming and Scripting | 0 | 07-19-2006 08:28 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Incremental log parser
I have log file that is incremented every second and is rather big. I need monitor error in this file. I do not want to parse it all every time.
I want parse it first time then remember last position (as byte for example) All consequent parsing I want to start from last saved position to the end of file. Up to now I use this method COUNT_OLD=`awk '$1>=0 {print $1}' file.seq` COUNT_NEW=`cat file | wc –l` #get file lines count cat file | grep -nf file.search | tr ':' ' ' | awk '$1 > '$COUNT_OLD' && $1 < ‘$COUNT_NEW’{print "FOUND: "$0}' > errors echo $COUNT_NEW > file.seq I.e. using “grep -n” feature manually select only new lines.So it does not really “incremental”. Other approach is to use for example “head” or “tail -n” command to copy new line some where and parse only that file but I think it is inefficient… I want to read directly from middle of the file. For example if file 1000 byte. I want to read directly from 100 byte to 999 byte. Is it possible by standard shell commands? Or I need use some of programming languages? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|