spiral25 Posted May 3, 2014 Report Posted May 3, 2014 Bhayya i need some help I have a log file name (X.log). In this X log there were four batch process running lets suppose take it as A,B,C,D. For batch process A - i know start time and end time - B/w these times i need to grab some errors popping up.. The errors would indicate as 'Typo Error'. Note- Only typo errors should be grabbed Note : All A, B, C, D would be running in same log file Similarly i have to do it for B,C and D also Plz help me...Deeniki emyna script raayaalaa
SamosaChai Posted May 3, 2014 Report Posted May 3, 2014 What is log time format? paste some lines here, I'll try to give exact syntax to capture
spiral25 Posted May 3, 2014 Author Report Posted May 3, 2014 What is log time format? paste some lines here, I'll try to give exact syntax to capture Bhayya its like lm123456.log (log file) time format - Start time 2014:05:01 00:00:05 End time -2014:05:01 08:45:45 'error vachi - 'typo error' awk [2014:05:01 00:00:05 - 2014:05:01 08:45:45] | grep typo error lm123456.log elaga chesthey vastundhaa Naku correct ga teliyadhu..ma frnd ki kavali anadu so naku elaga chepadu...naku unix scripting radhu andukey eakda post chesa evaryna answers isthey cchala helpful
spiral25 Posted May 3, 2014 Author Report Posted May 3, 2014 Bhayya eddho examples icha anthey..evi actual format kadhuu
KaskaMiska Posted May 3, 2014 Report Posted May 3, 2014 sed -n '/Apr 01 00:00:05/ , /Apr 01 08:45:45/p' lm123456.log | grep "typo error" you can also use below format for sed sed -n '/2014-3-06 11:34:48/,/2014-3-06 16:34:48/p'
spiral25 Posted May 3, 2014 Author Report Posted May 3, 2014 sed -n '/Apr 01 00:00:05/ , /Apr 01 08:45:45/p' lm123456.log | grep "typo error" you can also use below format for sed sed -n '/2014-3-06 11:34:48/,/2014-3-06 16:34:48/p' ila command ishtey then we can get the errors from aa particualar time period for batch process A na...
spiral25 Posted May 3, 2014 Author Report Posted May 3, 2014 sed -n '/Apr 01 00:00:05/ , /Apr 01 08:45:45/p' lm123456.log | grep "typo error" you can also use below format for sed sed -n '/2014-3-06 11:34:48/,/2014-3-06 16:34:48/p' sed - used to get al the data b/w time stamps aa What is /p is for? bhayya telsukundamani adugutunna
KaskaMiska Posted May 3, 2014 Report Posted May 3, 2014 ila command ishtey then we can get the errors from aa particualar time period for batch process A na... same log antunnav kabatti ala command isthe aa particular time lo "typo error" ane strings vasthai. It doesn't depend on A or B or C or D process. If time period is different for other process, it will become little complex
KaskaMiska Posted May 3, 2014 Report Posted May 3, 2014 sed - used to get al the data b/w time stamps aa What is /p is for? bhayya telsukundamani adugutunna best way to know any command. type man <command> on a unix server ex : man sed http://unixhelp.ed.ac.uk/CGI/man-cgi?sed
spiral25 Posted May 3, 2014 Author Report Posted May 3, 2014 sed -n '/2014:05:06 00:04:45/ , /2014:05:06 08:35:45/p' lm 123456.log | grep -i typo error ela rasthey work out avtundhi anamataa...
KaskaMiska Posted May 3, 2014 Report Posted May 3, 2014 sed -n '/2014:05:06 00:04:45/ , /2014:05:06 08:35:45/p' lm 123456.log | grep -i typo error ela rasthey work out avtundhi anamataa... use double quotes for string because it has space "type error"
Recommended Posts