Hi There,
I haven't done a lot of scripting so I'm struggling - any help muchly appreciated. Brief explanation below incase there is an easier way to do this?
I have a script that runs through a list of files created within the last day and greps Error it then outputs that line to results.lst as follows:
find /sam/test/blah* -mtime -1 -print | xargs grep Error >> results.lst
My results file holds the following info:
/u01/sam/blah.Sun:29/10/2007 10:17:23 Script 1b Error up filesystem /u03 - see /u01/adm/testlogs/u02_testing.log for details
/u01/sam/blah.Sun:29/10/2007 10:17:23 Script 1b Error up filesystem /u03 - see /u06/adm/testlogs/u02_testing.log for details
There are possibly a few ways to do this what I want to do is tail -5 the files /u01/adm/testlogs/u02_testing.log and /u01/adm/testlogs/u02_testing.log and then send then create a file with last 5 lines of each *.log so I can auto email the errors.
Any ideas?
Many thanks,
Sam
I haven't done a lot of scripting so I'm struggling - any help muchly appreciated. Brief explanation below incase there is an easier way to do this?
I have a script that runs through a list of files created within the last day and greps Error it then outputs that line to results.lst as follows:
find /sam/test/blah* -mtime -1 -print | xargs grep Error >> results.lst
My results file holds the following info:
/u01/sam/blah.Sun:29/10/2007 10:17:23 Script 1b Error up filesystem /u03 - see /u01/adm/testlogs/u02_testing.log for details
/u01/sam/blah.Sun:29/10/2007 10:17:23 Script 1b Error up filesystem /u03 - see /u06/adm/testlogs/u02_testing.log for details
There are possibly a few ways to do this what I want to do is tail -5 the files /u01/adm/testlogs/u02_testing.log and /u01/adm/testlogs/u02_testing.log and then send then create a file with last 5 lines of each *.log so I can auto email the errors.
Any ideas?
Many thanks,
Sam