Newbie Question to evaluate a huge logfile
Hi
I'm having a big logfile about 30 MB
now I have similar entries to this:
main warning: vout synchro warning: pts != current_date (-12267)
main warning: vout synchro warning: pts != current_date (-10778)
main warning: vout synchro warning: pts != current_date (12733)
main warning: vout synchro warning: pts != current_date (-13378)
main warning: vout synchro warning: pts != current_date (10500)
main debug: decoded 45/108 pictures
main warning: vout synchro warning: pts != current_date (-10511)
main warning: vout synchro warning: pts != current_date (11667)
main warning: vout synchro warning: pts != current_date (-13034)
main warning: vout synchro warning: pts != current_date (11311)
main warning: vout synchro warning: pts != current_date (11700)
main warning: vout synchro warning: pts != current_date (-13411)
main warning: vout synchro warning: pts != current_date (15122)
main warning: vout synchro warning: pts != current_date (-10711)
main warning: vout synchro warning: pts != current_date (10089)
main warning: vout synchro warning: pts != current_date (13356)
main warning: vout synchro warning: pts != current_date (-10745)
main warning: vout synchro warning: pts != current_date (12067)
main warning: late picture skipped (3396230)
main warning: vout synchro warning: pts != current_date (-13078)
main warning: vout synchro warning: pts != current_date (10067)
main warning: late picture skipped (3428374)
main debug: decoded 97/108 pictures
what i want to do is sum the numbers after "main debug: decoded XXX/108"
I want to sum over all XXX
is there a tool which can do that? is there a way to simply delete everything else?
thanks a lot
jossi
The easiest way I can think of to do this would be to search the entire file for the string "main debug: decoded", and if you find it, you know the next token will be numerical, and the one you want.
As for deleting everything else, you would be best off saving all things you want to keep somewhere in memory, deleting everything in the file, then re-writing it when you are done processing the file.
As for deleting everything else, you would be best off saving all things you want to keep somewhere in memory, deleting everything in the file, then re-writing it when you are done processing the file.
On any linux terminal (including cygwin):
cat logfile|sed 's/^/#/;s%.*decoded \(.*\)/.*%\1%;/#/d'|awk 'BEGIN{i=0}/.*/{i+=$1}END{print i}'
I'd say, write a Perl or Python script for it, or use a regular expression to strip all but the numbers you need from the file.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement